diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index a69bda99..b689ceee 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -8,7 +8,7 @@ Changelog - 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 `__ 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 displays the BigQuery Job ID in verbose output. (:issue:`70`) +- ``read_gbq`` now displays the BigQuery Job ID and standard price in verbose output. (:issue:`70` and :issue:`71`) 0.1.6 / 2017-05-03 ------------------ diff --git a/pandas_gbq/gbq.py b/pandas_gbq/gbq.py index 5fa78153..452de5ef 100644 --- a/pandas_gbq/gbq.py +++ b/pandas_gbq/gbq.py @@ -202,6 +202,10 @@ def __init__(self, project_id, reauth=False, verbose=False, self.credentials = self.get_credentials() self.service = self.get_service() + # BQ Queries costs $5 per TB. First 1 TB per month is free + # see here for more: https://cloud.google.com/bigquery/pricing + self.query_price_for_TB = 5. / 2**40 # USD/TB + def get_credentials(self): if self.private_key: return self.get_service_account_credentials() @@ -545,8 +549,10 @@ def run_query(self, query, **kwargs): else: bytes_processed = int(query_reply.get( 'totalBytesProcessed', '0')) - self._print('Query done.\nProcessed: {}\n'.format( + self._print('Query done.\nProcessed: {}'.format( self.sizeof_fmt(bytes_processed))) + self._print('Standard price: ${:,.2f} USD\n'.format( + bytes_processed * self.query_price_for_TB)) self._print('Retrieving results...')