Skip to content

feat(bigquery): add bigquery_federated_query_alloydb sample to run a … - #14731

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

iennae merged 1 commit into
mainfrom
feat/bq-federated-query-alloydb

Conversation

@iennae

@iennae iennae commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

…federated query against AlloyDB for PostgreSQL

Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/alloydb-federated-queries) needs a standalone, tested Python code sample demonstrating how to run a federated query against AlloyDB for PostgreSQL (region tag bigquery_federated_query_alloydb).

Solution:

  • Add federated_query_alloydb(project_id: str, connection_id: str) -> None in bigquery/federated_queries/bigquery_federated_query_alloydb.py (Query an AlloyDB for PostgreSQL table in real time from BigQuery using EXTERNAL_QUERY.)
  • Add unit tests (bigquery/federated_queries/bigquery_federated_query_alloydb_test.py) covering both the success path and API error handling (GoogleAPICallError)

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

@iennae
iennae requested review from a team and chalmerlowe as code owners November 2, 2026 23:17
@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the BigQuery API. label Nov 2, 2026
@snippet-bot

snippet-bot Bot commented Nov 2, 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 the samples Issues that are directly related to samples. label Nov 2, 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 sample for running federated queries from BigQuery to AlloyDB, along with its corresponding unit tests and configuration files. The feedback recommends adjusting the Python versions in the test configuration to target only the oldest and newest supported releases, and removing unnecessary environment markers for unsupported Python versions in the test requirements.

@@ -0,0 +1 @@
pytest==9.0.3; 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

Since Python versions below 3.10 are no longer supported, there is no need to specify environment markers or fallback dependency versions for Python versions older than 3.10. Please remove the ; python_version >= "3.10" marker.

pytest==9.0.3
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.

@iennae
iennae force-pushed the feat/bq-federated-query-alloydb branch from 0e0454a to 5a3a373 Compare November 2, 2026 23:33
…federated query against AlloyDB for PostgreSQL

Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/alloydb-federated-queries)
needs a standalone, tested Python code sample demonstrating how to
run a federated query against AlloyDB for PostgreSQL (region tag `bigquery_federated_query_alloydb`).

Solution:
- Add `federated_query_alloydb(project_id: str, connection_id: str) -> None` in `bigquery/federated_queries/bigquery_federated_query_alloydb.py`
  (Query an AlloyDB for PostgreSQL table in real time from BigQuery using EXTERNAL_QUERY.)
- Add unit tests (`bigquery/federated_queries/bigquery_federated_query_alloydb_test.py`) covering both the success
  path and API error handling (`GoogleAPICallError`)
@iennae
iennae force-pushed the feat/bq-federated-query-alloydb branch from 5a3a373 to 756a0ba Compare November 3, 2026 02:44

@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

@iennae
iennae merged commit da977a4 into main Nov 3, 2026
13 of 21 checks passed
@iennae
iennae deleted the feat/bq-federated-query-alloydb branch November 3, 2026 18:54
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