Skip to content

feat(bigquery): add bigquery_federated_view_schema_cloud_sql sample t… - #14735

Merged
iennae merged 1 commit into
mainfrom
feat/bq-federated-view-schema-cloud-sql
Nov 4, 2026
Merged

iennae merged 1 commit into
mainfrom
feat/bq-federated-view-schema-cloud-sql

Conversation

@iennae

@iennae iennae commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

…o inspect Cloud SQL table schema via federated query

Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/cloud-sql-federated-queries) needs a standalone, tested Python code sample demonstrating how to inspect Cloud SQL table schema via federated query (region tag bigquery_federated_view_schema_cloud_sql).

Solution:

  • Add federated_view_schema_cloud_sql(project_id: str, connection_id: str) -> None in bigquery/federated_queries/bigquery_federated_view_schema_cloud_sql.py (Query information_schema.columns in a Cloud SQL database from BigQuery using EXTERNAL_QUERY.)
  • Add unit tests (bigquery/federated_queries/bigquery_federated_view_schema_cloud_sql_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:22
@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 api: bigquery Issues related to the BigQuery API. samples Issues that are directly related to samples. labels 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 Python sample and associated unit tests for viewing a Cloud SQL table schema from BigQuery using an external query. It also adds the necessary configuration and dependency files for testing. The review feedback recommends updating the noxfile_config.py to align with testing guidelines by only testing the oldest and newest supported Python versions (3.10 and 3.13) and ignoring the intermediate versions (3.11 and 3.12).

@iennae
iennae force-pushed the feat/bq-federated-view-schema-cloud-sql branch 2 times, most recently from 6c161ea to 5515f11 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, mock for failing test could swap where exception is raised to mock_client.result.

…o inspect Cloud SQL table schema via federated query

Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/cloud-sql-federated-queries)
needs a standalone, tested Python code sample demonstrating how to
inspect Cloud SQL table schema via federated query (region tag `bigquery_federated_view_schema_cloud_sql`).

Solution:
- Add `federated_view_schema_cloud_sql(project_id: str, connection_id: str) -> None` in `bigquery/federated_queries/bigquery_federated_view_schema_cloud_sql.py`
  (Query information_schema.columns in a Cloud SQL database from BigQuery using EXTERNAL_QUERY.)
- Add unit tests (`bigquery/federated_queries/bigquery_federated_view_schema_cloud_sql_test.py`) covering both the success
  path and API error handling (`GoogleAPICallError`)
@iennae
iennae force-pushed the feat/bq-federated-view-schema-cloud-sql branch from 5515f11 to 2aac8a1 Compare November 3, 2026 23:32
@iennae
iennae merged commit 79ef281 into main Nov 4, 2026
14 of 22 checks passed
@iennae
iennae deleted the feat/bq-federated-view-schema-cloud-sql branch November 4, 2026 00:53
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