Skip to content

feat(bigquery): add bigquery_create_procedure sample to create a SQL … - #14753

Open
iennae wants to merge 1 commit into
mainfrom
feat/bq-create-procedure
Open

iennae wants to merge 1 commit into
mainfrom
feat/bq-create-procedure

Conversation

@iennae

@iennae iennae commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

…stored procedure

Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/procedures) needs a standalone, tested Python code sample demonstrating how to create a SQL stored procedure (region tag bigquery_create_procedure).

Solution:

  • Add create_procedure(project_id: str, dataset_id: str) -> None in bigquery/stored_procedures/bigquery_create_procedure.py (Create a reusable multi-statement GoogleSQL stored procedure inside a BigQuery dataset using CREATE PROCEDURE.)
  • Add unit tests (bigquery/stored_procedures/bigquery_create_procedure_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:31
@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 sample for creating a BigQuery stored procedure, complete with its implementation, unit tests, and configuration files. The feedback suggests updating the Python test configuration in noxfile_config.py to target only the oldest and newest supported Python versions (3.10 and 3.13) by ignoring intermediate versions. Additionally, it recommends removing the unnecessary environment marker for Python 3.10 in requirements-test.txt and using the === operator for strict version pinning.

@@ -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, we should not specify environment markers for Python versions older than 3.10. Please remove the ; python_version >= "3.10" marker. Additionally, use the === operator for version pinning in requirements files to prevent automated updates from overwriting specific version numbers.

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.
  2. Use the === operator in requirements.txt for version pinning to prevent automated updates from overwriting specific version numbers required for certain Python runtimes.

@iennae
iennae force-pushed the feat/bq-create-procedure branch 2 times, most recently from 23dd9e0 to c445f53 Compare November 3, 2026 02:44
…stored procedure

Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/procedures)
needs a standalone, tested Python code sample demonstrating how to
create a SQL stored procedure (region tag `bigquery_create_procedure`).

Solution:
- Add `create_procedure(project_id: str, dataset_id: str) -> None` in `bigquery/stored_procedures/bigquery_create_procedure.py`
  (Create a reusable multi-statement GoogleSQL stored procedure inside a BigQuery dataset using CREATE OR REPLACE PROCEDURE.)
- Add unit tests (`bigquery/stored_procedures/bigquery_create_procedure_test.py`) covering both the success
  path and API error handling (`GoogleAPICallError`)
@iennae
iennae force-pushed the feat/bq-create-procedure branch from c445f53 to 159a10b Compare November 3, 2026 23:32

@amcolin amcolin 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!

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