Skip to content

feat: add PendingDeprecationWarning for to_dataframe and to_arrow conversion methods - #18021

Open
shuoweil wants to merge 6 commits into
mainfrom
shuowei-gbq-to-dataframe-arrow-warnings
Open

feat: add PendingDeprecationWarning for to_dataframe and to_arrow conversion methods#18021
shuoweil wants to merge 6 commits into
mainfrom
shuowei-gbq-to-dataframe-arrow-warnings

Conversation

@shuoweil

@shuoweil shuoweil commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

As part of the pandas-gbq migration and API unification strategy, this PR introduces PendingDeprecationWarning to the core conversion wrapper methods in google-cloud-bigquery.

This alerts developers to adopt direct, optimized pandas-gbq entry points (pandas_gbq.read_gbq() and pandas_gbq.arrow.*) ahead of future deprecation phases.

Fixes #<526614511> 🦕

@shuoweil
shuoweil requested review from sycai and tswast August 6, 2026 21:53
@shuoweil shuoweil self-assigned this Aug 6, 2026
@shuoweil
shuoweil requested review from a team as code owners August 6, 2026 21:53

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request deprecates the core SDK conversion methods to_arrow and to_dataframe by adding PendingDeprecationWarning warnings, recommending direct usage of pandas_gbq instead. It also ensures internal calls (such as in to_geodataframe) suppress these warnings, and adds unit tests to verify this behavior. The feedback suggests explicitly setting warnings.simplefilter("always") in the test for to_geodataframe to guarantee that the PendingDeprecationWarning is not silently ignored by Python's default warning filters.

Comment thread packages/google-cloud-bigquery/tests/unit/test_table.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@shuoweil shuoweil added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 6, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 6, 2026
)

_TO_DATAFRAME_DEPRECATED = (
"Retrieving DataFrames via core SDK conversion methods is deprecated. "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we replace "core SDK" with "google-cloud-bigquery" ? The user might not understand what "core SDK" means

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point! Updated to "Retrieving DataFrames via google-cloud-bigquery is deprecated. For direct, optimized access, please call 'pandas_gbq.read_gbq()' directly."

)

_TO_ARROW_DEPRECATED = (
"Retrieving PyArrow Tables via core SDK conversion methods is deprecated. "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe update the "core SDK" mentioning here too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, updated here as well.

@shuoweil
shuoweil requested a review from sycai August 7, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants