Skip to content

Reduce verbosity of logging #201

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 2 commits into from
Aug 25, 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
2 changes: 2 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Changelog
``DataFrame`` construction to the Pandas library, radically reducing
the number of loops that execute in python
(:issue:`128`)
- Reduced verbosity of logging from ``read_gbq``, particularly for short
queries. (:issue:`201`)

.. _changelog-0.6.0:

Expand Down
13 changes: 4 additions & 9 deletions pandas_gbq/gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@ def run_query(self, query, **kwargs):
self._start_timer()

try:
logger.info('Requesting query... ')
logger.debug('Requesting query... ')
query_reply = self.client.query(
query,
job_config=bigquery.QueryJobConfig.from_api_repr(job_config),
location=self.location)
logger.info('ok.\nQuery running...')
logger.info('Query running...')
except (RefreshError, ValueError):
if self.private_key:
raise AccessDenied(
Expand All @@ -258,7 +258,7 @@ def run_query(self, query, **kwargs):
self.process_http_error(ex)

job_id = query_reply.job_id
logger.info('Job ID: %s\nQuery running...' % job_id)
logger.debug('Job ID: %s' % job_id)

while query_reply.state != 'DONE':
self.log_elapsed_seconds(' Elapsed', 's. Waiting...')
Expand Down Expand Up @@ -303,8 +303,7 @@ def run_query(self, query, **kwargs):
for field in rows_iter.schema],
}

# log basic query stats
logger.info('Got {} rows.\n'.format(total_rows))
logger.debug('Got {} rows.\n'.format(total_rows))

return schema, result_rows

Expand All @@ -314,7 +313,6 @@ def load_data(
from pandas_gbq import load

total_rows = len(dataframe)
logger.info("\n\n")

try:
chunks = load.load_chunks(self.client, dataframe, dataset_id,
Expand All @@ -328,8 +326,6 @@ def load_data(
except self.http_error as ex:
self.process_http_error(ex)

logger.info("\n")

def schema(self, dataset_id, table_id):
"""Retrieve the schema of the table

Expand Down Expand Up @@ -611,7 +607,6 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
connector.log_elapsed_seconds(
'Total time taken',
datetime.now().strftime('s.\nFinished at %Y-%m-%d %H:%M:%S.'),
0
)

return final_df
Expand Down