Skip to content

Commit 454cd4e

Browse files
committed
ENH: Update pandas-gbq to 0.10.0.
1 parent b90f9db commit 454cd4e

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

doc/source/whatsnew/v0.25.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ Optional libraries below the lowest tested version may still work, but are not c
191191
+-----------------+-----------------+
192192
| openpyxl | 2.4.0 |
193193
+-----------------+-----------------+
194+
| pandas-gbq | 0.10.0 |
195+
+-----------------+-----------------+
194196
| pyarrow | 0.9.0 |
195197
+-----------------+-----------------+
196198
| pytables | 3.4.2 |
@@ -364,6 +366,7 @@ I/O
364366
- Improved the explanation for the failure when value labels are repeated in Stata dta files and suggested work-arounds (:issue:`25772`)
365367
- Improved :meth:`pandas.read_stata` and :class:`pandas.io.stata.StataReader` to read incorrectly formatted 118 format files saved by Stata (:issue:`25960`)
366368
- Fixed bug in loading objects from S3 that contain ``#`` characters in the URL (:issue:`25945`)
369+
- Updated :func:`read_gbq` to version 0.10.0 of the ``pandas-gbq`` library. Adds ``use_bqstorage_api`` parameter to speed up downloads of large data frames.
367370

368371
Plotting
369372
^^^^^^^^

pandas/io/gbq.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _try_import():
2626
def read_gbq(query, project_id=None, index_col=None, col_order=None,
2727
reauth=False, auth_local_webserver=False, dialect=None,
2828
location=None, configuration=None, credentials=None,
29-
private_key=None, verbose=None):
29+
use_bqstorage_api=None, private_key=None, verbose=None):
3030
"""
3131
Load data from Google BigQuery.
3232
@@ -103,6 +103,20 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
103103
*New in version 0.8.0 of pandas-gbq*.
104104
105105
.. versionadded:: 0.24.0
106+
use_bqstorage_api : bool, default False
107+
Use the `BigQuery Storage API
108+
<https://cloud.google.com/bigquery/docs/reference/storage/>`__ to
109+
download query results quickly, but at an increased cost. To use this
110+
API, first `enable it in the Cloud Console
111+
<https://console.cloud.google.com/apis/library/bigquerystorage.googleapis.com>`__.
112+
You must also have the `bigquery.readsessions.create
113+
<https://cloud.google.com/bigquery/docs/access-control#roles>`__
114+
permission on the project you are billing queries to.
115+
116+
This feature requires the ``google-cloud-bigquery-storage`` and
117+
``fastavro`` packages.
118+
119+
.. versionadded:: 0.25.0
106120
private_key : str, deprecated
107121
Deprecated in pandas-gbq version 0.8.0. Use the ``credentials``
108122
parameter and
@@ -131,22 +145,13 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
131145
"""
132146
pandas_gbq = _try_import()
133147

134-
if dialect is None:
135-
dialect = "legacy"
136-
warnings.warn(
137-
'The default value for dialect is changing to "standard" in a '
138-
'future version of pandas-gbq. Pass in dialect="legacy" to '
139-
"disable this warning.",
140-
FutureWarning,
141-
stacklevel=2,
142-
)
143-
144148
return pandas_gbq.read_gbq(
145149
query, project_id=project_id, index_col=index_col,
146150
col_order=col_order, reauth=reauth,
147151
auth_local_webserver=auth_local_webserver, dialect=dialect,
148152
location=location, configuration=configuration,
149-
credentials=credentials, verbose=verbose, private_key=private_key)
153+
credentials=credentials, use_bqstorage_api=use_bqstorage_api,
154+
verbose=verbose, private_key=private_key)
150155

151156

152157
def to_gbq(dataframe, destination_table, project_id=None, chunksize=None,

pandas/tests/io/test_gbq.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,6 @@ def make_mixed_dataframe_v2(test_size):
9090
index=range(test_size))
9191

9292

93-
def test_read_gbq_without_dialect_warns_future_change(monkeypatch):
94-
# Default dialect is changing to standard SQL. See:
95-
# https://github.com/pydata/pandas-gbq/issues/195
96-
97-
def mock_read_gbq(*args, **kwargs):
98-
return DataFrame([[1.0]])
99-
100-
monkeypatch.setattr(pandas_gbq, 'read_gbq', mock_read_gbq)
101-
with tm.assert_produces_warning(FutureWarning):
102-
pd.read_gbq("SELECT 1")
103-
104-
10593
@pytest.mark.single
10694
class TestToGBQIntegrationWithServiceAccountKeyPath(object):
10795

0 commit comments

Comments
 (0)