Skip to content

Commit 6e1ba74

Browse files
authored
BUG: avoid OOB flow in read_gbq and to_gbq (#46312)
1 parent ab42286 commit 6e1ba74

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

doc/source/whatsnew/v1.5.0.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,13 @@ See :ref:`install.dependencies` and :ref:`install.optional_dependencies` for mor
196196

197197
Other API changes
198198
^^^^^^^^^^^^^^^^^
199-
-
199+
200+
- BigQuery I/O methods :func:`read_gbq` and :meth:`DataFrame.to_gbq` default to
201+
``auth_local_webserver = True``. Google has deprecated the
202+
``auth_local_webserver = False`` `"out of band" (copy-paste) flow
203+
<https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob>`_.
204+
The ``auth_local_webserver = False`` option is planned to stop working in
205+
October 2022. (:issue:`46312`)
200206
-
201207

202208
.. ---------------------------------------------------------------------------

pandas/core/frame.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,7 @@ def to_gbq(
19781978
chunksize: int | None = None,
19791979
reauth: bool = False,
19801980
if_exists: str = "fail",
1981-
auth_local_webserver: bool = False,
1981+
auth_local_webserver: bool = True,
19821982
table_schema: list[dict[str, str]] | None = None,
19831983
location: str | None = None,
19841984
progress_bar: bool = True,
@@ -2016,7 +2016,7 @@ def to_gbq(
20162016
If table exists, drop it, recreate it, and insert data.
20172017
``'append'``
20182018
If table exists, insert data. Create if does not exist.
2019-
auth_local_webserver : bool, default False
2019+
auth_local_webserver : bool, default True
20202020
Use the `local webserver flow`_ instead of the `console flow`_
20212021
when getting user credentials.
20222022
@@ -2026,6 +2026,12 @@ def to_gbq(
20262026
https://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_console
20272027
20282028
*New in version 0.2.0 of pandas-gbq*.
2029+
2030+
.. versionchanged:: 1.5.0
2031+
Default value is changed to ``True``. Google has deprecated the
2032+
``auth_local_webserver = False`` `"out of band" (copy-paste)
2033+
flow
2034+
<https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob>`_.
20292035
table_schema : list of dicts, optional
20302036
List of BigQuery table fields to which according DataFrame
20312037
columns conform to, e.g. ``[{'name': 'col1', 'type':

pandas/io/gbq.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def read_gbq(
2929
index_col: str | None = None,
3030
col_order: list[str] | None = None,
3131
reauth: bool = False,
32-
auth_local_webserver: bool = False,
32+
auth_local_webserver: bool = True,
3333
dialect: str | None = None,
3434
location: str | None = None,
3535
configuration: dict[str, Any] | None = None,
@@ -63,7 +63,7 @@ def read_gbq(
6363
reauth : bool, default False
6464
Force Google BigQuery to re-authenticate the user. This is useful
6565
if multiple accounts are used.
66-
auth_local_webserver : bool, default False
66+
auth_local_webserver : bool, default True
6767
Use the `local webserver flow`_ instead of the `console flow`_
6868
when getting user credentials.
6969
@@ -73,6 +73,12 @@ def read_gbq(
7373
https://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_console
7474
7575
*New in version 0.2.0 of pandas-gbq*.
76+
77+
.. versionchanged:: 1.5.0
78+
Default value is changed to ``True``. Google has deprecated the
79+
``auth_local_webserver = False`` `"out of band" (copy-paste)
80+
flow
81+
<https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob>`_.
7682
dialect : str, default 'legacy'
7783
Note: The default value is changing to 'standard' in a future version.
7884
@@ -202,7 +208,7 @@ def to_gbq(
202208
chunksize: int | None = None,
203209
reauth: bool = False,
204210
if_exists: str = "fail",
205-
auth_local_webserver: bool = False,
211+
auth_local_webserver: bool = True,
206212
table_schema: list[dict[str, str]] | None = None,
207213
location: str | None = None,
208214
progress_bar: bool = True,

0 commit comments

Comments
 (0)