8000 chore: prevent location warning when `_read_gbq_colab` can determine the location by tswast · Pull Request #1802 · googleapis/python-bigquery-dataframes · GitHub
[go: up one dir, main page]

Skip to content

chore: prevent location warning when _read_gbq_colab can determine the location #1802

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

Merged
merged 5 commits into from
Jun 10, 2025

Conversation

tswast
Copy link
Collaborator
@tswast tswast commented Jun 9, 2025

…can determine the location for bigframes.pandas.io.api._read_gbq_colab.

I've updated bigframes.pandas.io.api._read_gbq_colab so it correctly calls bigframes.session.Session._read_gbq_colab and adjusted its arguments.

The _read_gbq_colab function in the pandas API layer now has a simpler signature, accepting query_or_table, pyformat_args, and dry_run. It will continue to call _set_default_session_location_if_possible to prevent location warnings.

I've also updated the unit tests to reflect these changes, making sure that the correct session-level function is called and that arguments are passed through as expected. I've also moved the tests to tests/unit/pandas/io/test_api.py and converted them to pytest style to follow our repository conventions.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes internal issue b/423657977 🦕

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Jun 9, 2025
…e location

I've made some updates to prevent a location warning when the system can determine the location for `bigframes.pandas.io.api._read_gbq_colab`.

I've updated `bigframes.pandas.io.api._read_gbq_colab` so it correctly calls `bigframes.session.Session._read_gbq_colab` and adjusted its arguments.

The `_read_gbq_colab` function in the pandas API layer now has a simpler signature, accepting `query_or_table`, `pyformat_args`, and `dry_run`. It will continue to call `_set_default_session_location_if_possible` to prevent location warnings.

I've also updated the unit tests to reflect these changes, making sure that the correct session-level function is called and that arguments are passed through as expected. I've also moved the tests to `tests/unit/pandas/io/test_api.py` and converted them to pytest style to follow our repository conventions.
@tswast tswast force-pushed the b423657977-read_gbq_colab-location-warning branch from 70affa0 to c6df394 Compare June 9, 2025 21:38
@tswast tswast marked this pull request as ready for review June 9, 2025 21:38
@tswast tswast requested review from a team as code owners June 9, 2025 21:38
@tswast tswast requested a review from Genesis929 June 9, 2025 21:38
Genesis929
Genesis929 previously approved these changes Jun 10, 2025
Union[bigframes.dataframe.DataFrame, pandas.Series]:
A BigQuery DataFrame if `dry_run` is False, otherwise a pandas Series.
"""
_set_default_session_location_if_possible(query_or_table)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the first query has any format variables, the dry run could fail.

CC @TrevorBergeron

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to run pyformat first.

@tswast tswast merged commit 3edc313 into main Jun 10, 2025
18 of 24 checks passed
@tswast tswast deleted the b423657977-read_gbq_colab-location-warning branch June 10, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 67E3 to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0