Skip to content

Commit

Permalink
ENH: BQ Job Id in verbose output (googleapis#70)
Browse files Browse the repository at this point in the history
* ENH: BQ Job Id in verbose output
* changelog entry
  • Loading branch information
tworec authored Jul 11, 2017
1 parent dd53b5c commit 269685c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Changelog
- Drop support for Python 3.4 (:issue:`40`)
- The dataframe passed to ```.to_gbq(...., if_exists='append')``` needs to contain only a subset of the fields in the BigQuery schema. (:issue:`24`)
- Use the `google-auth <https://google-auth.readthedocs.io/en/latest/>`__ library for authentication because oauth2client is deprecated. (:issue:`39`)
- ``read_gbq`` now has a ``auth_local_webserver`` boolean argument for controlling whether to use web server or console flow when getting user credentials. Replaces `--noauth_local_webserver` command line argument (:issue:`35`)
- ``read_gbq`` now has a ``auth_local_webserver`` boolean argument for controlling whether to use web server or console flow when getting user credentials. Replaces `--noauth_local_webserver` command line argument. (:issue:`35`)
- ``read_gbq`` now displays the BigQuery Job ID in verbose output. (:issue:`70`)

0.1.6 / 2017-05-03
------------------
Expand Down
8 changes: 5 additions & 3 deletions pandas_gbq/gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ def run_query(self, query, **kwargs):
self._print('Requesting query... ', end="")
query_reply = job_collection.insert(
projectId=self.project_id, body=job_data).execute()
self._print('ok.\nQuery running...')
self._print('ok.')
except (RefreshError, ValueError):
if self.private_key:
raise AccessDenied(
Expand All @@ -527,13 +527,15 @@ def run_query(self, query, **kwargs):
self.process_http_error(ex)

job_reference = query_reply['jobReference']
job_id = job_reference['jobId']
self._print('Job ID: %s\nQuery running...' % job_id)

while not query_reply.get('jobComplete', False):
self.print_elapsed_seconds(' Elapsed', 's. Waiting...')
try:
query_reply = job_collection.getQueryResults(
projectId=job_reference['projectId'],
jobId=job_reference['jobId']).execute()
jobId=job_id).execute()
except HttpError as ex:
self.process_http_error(ex)

Expand Down Expand Up @@ -584,7 +586,7 @@ def run_query(self, query, **kwargs):
try:
query_reply = job_collection.getQueryResults(
projectId=job_reference['projectId'],
jobId=job_reference['jobId'],
jobId=job_id,
pageToken=page_token).execute()
except HttpError as ex:
self.process_http_error(ex)
Expand Down

0 comments on commit 269685c

Please sign in to comment.