-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
[ENH] pull in warning for dialect change from pandas-gbq #22557
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
""" Google BigQuery support """ | ||
|
||
import warnings | ||
|
||
|
||
def _try_import(): | ||
# since pandas is a dependency of pandas-gbq | ||
|
@@ -23,7 +25,7 @@ def _try_import(): | |
|
||
def read_gbq(query, project_id=None, index_col=None, col_order=None, | ||
reauth=False, private_key=None, auth_local_webserver=False, | ||
dialect='legacy', location=None, configuration=None, | ||
dialect=None, location=None, configuration=None, | ||
verbose=None): | ||
""" | ||
Load data from Google BigQuery. | ||
|
@@ -65,6 +67,8 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None, | |
*New in version 0.2.0 of pandas-gbq*. | ||
dialect : str, default 'legacy' | ||
Note: The default value is changing to 'standard' in a future verion. | ||
SQL syntax dialect to use. Value can be one of: | ||
``'legacy'`` | ||
|
@@ -76,6 +80,8 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None, | |
compliant with the SQL 2011 standard. For more information | ||
see `BigQuery Standard SQL Reference | ||
<https://cloud.google.com/bigquery/docs/reference/standard-sql/>`__. | ||
.. versionchanged:: 0.24.0 | ||
location : str, optional | ||
Location where the query job should run. See the `BigQuery locations | ||
documentation | ||
|
@@ -108,6 +114,17 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None, | |
pandas.DataFrame.to_gbq : Write a DataFrame to Google BigQuery. | ||
""" | ||
pandas_gbq = _try_import() | ||
|
||
if dialect is None: | ||
dialect = "legacy" | ||
warnings.warn( | ||
'The default value for dialect is changing to "standard" in a ' | ||
'future version of pandas-gbq. Pass in dialect="legacy" to ' | ||
"disable this warning.", | ||
FutureWarning, | ||
stacklevel=2, | ||
) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a good way to test this by any chance? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've got a test in the pandas-gbq repo: I suppose I should include a similar test here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it's possible to include in some shape or form, I would definitely be 👍 for it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added in 07c2eb8 |
||
return pandas_gbq.read_gbq( | ||
query, project_id=project_id, index_col=index_col, | ||
col_order=col_order, reauth=reauth, verbose=verbose, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a versionchanged (0.24.0)