Skip to content

feat(bigquery): add bigquery_query_iceberg_table sample to refresh an… - #14718

Merged
iennae merged 1 commit into
mainfrom
feat/bq-query-iceberg-table
Nov 3, 2026
Merged

iennae merged 1 commit into
mainfrom
feat/bq-query-iceberg-table

Conversation

@iennae

@iennae iennae commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

…d query an Apache Iceberg BigLake table

Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/query-iceberg-data) needs a standalone, tested Python code sample demonstrating how to refresh and query an Apache Iceberg BigLake table (region tag bigquery_query_iceberg_table).

Solution:

  • Add query_iceberg_table(project_id: str, dataset_id: str, table_id: str, connection_id: str, metadata_uri: str) -> None in bigquery/biglake/bigquery_query_iceberg_table.py (Update an Apache Iceberg external table definition to point to the latest metadata snapshot on Cloud Storage and query its rows.)
  • Add unit tests (bigquery/biglake/bigquery_query_iceberg_table_test.py) covering both the success path and API error handling (GoogleAPICallError)

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

@iennae
iennae requested review from a team and chalmerlowe as code owners November 1, 2026 20:22
@snippet-bot

snippet-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 1 region tag.

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

@product-auto-label product-auto-label Bot added api: bigquery Issues related to the BigQuery API. samples Issues that are directly related to samples. labels Nov 1, 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 a new Python sample and associated tests for refreshing and querying Apache Iceberg external tables in BigQuery. The feedback suggests improving the sample's reusability by replacing the specific column selection in the SQL query with a generic SELECT * and a LIMIT clause. Additionally, it recommends updating the test configuration in noxfile_config.py to only test the oldest and newest supported Python versions (3.10 and 3.13) in accordance with testing guidelines.

Comment thread bigquery/biglake/noxfile_config.py Resolved

@XrossFox XrossFox 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.

LGTM, some dependencies are outdated.

Comment thread bigquery/biglake/requirements.txt Resolved
@iennae
iennae force-pushed the feat/bq-query-iceberg-table branch 3 times, most recently from 43ac8a3 to e719bde Compare November 2, 2026 23:33
…d query an Apache Iceberg BigLake table

Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/query-iceberg-data)
needs a standalone, tested Python code sample demonstrating how to
refresh and query an Apache Iceberg BigLake table (region tag `bigquery_query_iceberg_table`).

Solution:
- Add `query_iceberg_table(project_id: str, dataset_id: str, table_id: str, connection_id: str, metadata_uri: str) -> None` in `bigquery/biglake/bigquery_query_iceberg_table.py`
  (Update an Apache Iceberg external table definition to point to the latest metadata snapshot on Cloud Storage and query its rows.)
- Add unit tests (`bigquery/biglake/bigquery_query_iceberg_table_test.py`) covering both the success
  path and API error handling (`GoogleAPICallError`)
@iennae
iennae force-pushed the feat/bq-query-iceberg-table branch from e719bde to 2578a5c Compare November 3, 2026 02:44
@iennae
iennae merged commit 0a4975d into main Nov 3, 2026
13 of 16 checks passed
@iennae
iennae deleted the feat/bq-query-iceberg-table branch November 3, 2026 02:50
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants