Skip to content

docs: add code samples for BigQuery dry run - #14703

Open
tswast wants to merge 6 commits into
GoogleCloudPlatform:mainfrom
tswast:polars
Open

tswast wants to merge 6 commits into
GoogleCloudPlatform:mainfrom
tswast:polars

Conversation

@tswast

@tswast tswast commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Towards internal issue b/579906804

Description

Fixes #

Checklist

Testing

  • I have tested this change on a live environment and verified it works as intended.

Compliance & Style


Post-Approval Actions

  • Please merge this PR for me once it is approved
Towards internal issue b/579906804
@tswast
tswast requested review from a team and chalmerlowe as code owners October 30, 2026 21:34
@snippet-bot

snippet-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 5 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment
@tswast
tswast requested a review from a team as a code owner October 30, 2026 21:34
@product-auto-label product-auto-label Bot added samples Issues that are directly related to samples. api: bigquery Issues related to the BigQuery API. labels Oct 30, 2026

@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 introduces new BigQuery samples for BigFrames, pandas-gbq migration, and Polars, including corresponding tests and configuration files. The review feedback highlights several necessary corrections: fixing a SQL syntax error (trailing comma) and mismatched region tags in the Polars samples, adhering to PEP 8 by removing spaces around keyword argument assignment, correcting a return type annotation in the BigFrames dry run sample, simplifying dependency requirements by removing markers for unsupported Python versions (< 3.10), and updating the test configuration to include Python 3.13.

Comment thread bigquery/polars/query_bqstorage.py Resolved
Comment thread bigquery/polars/query_bqstorage.py Resolved
Comment thread bigquery/polars/query_standard_sql.py Resolved
Comment thread bigquery/polars/query_bqstorage.py Resolved
Comment thread bigquery/polars/query_standard_sql.py Resolved

def query_dry_run(
project_id: str = "your-project-id",
) -> Tuple[pd.Series, pd.Series]:

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.

medium

The dry run operations in BigQuery DataFrames return metadata objects (or dict-like objects) rather than a pandas.Series. Update the return type annotation to Tuple[dict, dict] to accurately reflect the returned types.

Suggested change
) -> Tuple[pd.Series, pd.Series]:
) -> Tuple[dict, dict]:

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.

BigFrames does return a panda Series.

Comment on lines 3 to +9
pandas==2.0.3; python_version == '3.8'
pandas==2.2.3; python_version > '3.8'
pandas-gbq==0.24.0
pandas==2.2.3; python_version < '3.11'
pandas==3.1.0; python_version >= '3.11'
pandas-gbq==0.35.3
grpcio==1.70.0; python_version == '3.8'
grpcio==1.74.0; python_version > '3.8'
grpcio==1.74.0; python_version == '3.9'
grpcio==1.85.1; python_version >= '3.10'

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.

medium

Python versions below 3.10 are no longer supported. Please remove the fallback dependency versions and environment markers for Python 3.8 and 3.9, and simplify the requirements accordingly.

pandas==2.2.3; python_version < '3.11'
pandas==3.1.0; python_version >= '3.11'
pandas-gbq==0.35.3
grpcio==1.85.1
References
  1. Do not specify fallback dependency versions or environment markers for Python versions older than 3.10, as Python versions below 3.10 are no longer supported.
TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
# Skipping for Python 3.9 due to pyarrow compilation failure.
"ignored_versions": ["3.8", "3.9", "3.11", "3.12", "3.13"],

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.

medium

To adhere to the testing policy of only testing the oldest and newest supported Python releases, we should test Python 3.10 (oldest) and Python 3.13 (newest). Please remove Python 3.13 from the ignored versions list so that it is included in the test suite.

Suggested change
"ignored_versions": ["3.8", "3.9", "3.11", "3.12", "3.13"],
"ignored_versions": ["3.8", "3.9", "3.11", "3.12"],
References
  1. Only test the oldest and newest supported Python releases in test configurations (such as noxfile_config.py), ignoring intermediate versions.
tswast and others added 5 commits October 30, 2026 21:37
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigquery Issues related to the BigQuery API. samples Issues that are directly related to samples.

1 participant