Skip to content

[TST] Avoid listing datasets and tables in system tests #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 0 additions & 79 deletions pandas_gbq/gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,32 +1088,6 @@ def exists(self, dataset_id):
except self.http_error as ex:
self.process_http_error(ex)

def datasets(self):
""" Return a list of datasets in Google BigQuery

Parameters
----------
None

Returns
-------
list
List of datasets under the specific project
"""

dataset_list = []

try:
dataset_response = self.client.list_datasets()

for row in dataset_response:
dataset_list.append(row.dataset_id)

except self.http_error as ex:
self.process_http_error(ex)

return dataset_list

def create(self, dataset_id):
""" Create a dataset in Google BigQuery

Expand All @@ -1135,56 +1109,3 @@ def create(self, dataset_id):
self.client.create_dataset(dataset)
except self.http_error as ex:
self.process_http_error(ex)

def delete(self, dataset_id):
""" Delete a dataset in Google BigQuery

Parameters
----------
dataset : str
Name of dataset to be deleted
"""
from google.api_core.exceptions import NotFound

if not self.exists(dataset_id):
raise NotFoundException(
"Dataset {0} does not exist".format(dataset_id)
)

try:
self.client.delete_dataset(self.client.dataset(dataset_id))

except NotFound:
# Ignore 404 error which may occur if dataset already deleted
pass
except self.http_error as ex:
self.process_http_error(ex)

def tables(self, dataset_id):
""" List tables in the specific dataset in Google BigQuery

Parameters
----------
dataset : str
Name of dataset to list tables for

Returns
-------
list
List of tables under the specific dataset
"""

table_list = []

try:
table_response = self.client.list_tables(
self.client.dataset(dataset_id)
)

for row in table_response:
table_list.append(row.table_id)

except self.http_error as ex:
self.process_http_error(ex)

return table_list
Loading