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 all 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
11 changes: 10 additions & 1 deletion docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ Changelog

- Add :class:`pandas_gbq.Context` to cache credentials in-memory, across
calls to ``read_gbq`` and ``to_gbq``. (:issue:`198`, :issue:`208`)
- Fast queries now do not log above ``DEBUG`` level. (:issue:`204`).
- Fast queries now do not log above ``DEBUG`` level. (:issue:`204`)
With BigQuery's release of `clustering <https://cloud.google.com/bigquery/docs/clustered-tables>`__
querying smaller samples of data is now faster and cheaper.
- Don't load credentials from disk if reauth is ``True``. (:issue:`212`)
This fixes a bug where pandas-gbq could not refresh credentials if the
cached credentials were invalid, revoked, or expired, even when
``reauth=True``.

Internal changes
~~~~~~~~~~~~~~~~

- Avoid listing datasets and tables in system tests. (:issue:`215`)

.. _changelog-0.6.1:

Expand Down
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