diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index f5895b70..b4b53488 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -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: diff --git a/pandas_gbq/gbq.py b/pandas_gbq/gbq.py index 20e303bf..99150dc8 100644 --- a/pandas_gbq/gbq.py +++ b/pandas_gbq/gbq.py @@ -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( @@ -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...') @@ -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 @@ -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, @@ -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 @@ -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