Repository navigation
feat(bigquery): add bigquery_create_procedure sample to create a SQL … - #14753
Conversation
|
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
There was a problem hiding this comment.
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.
c445f53 to
159a10b
Compare
…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`)
159a10b to
3f431d1
Compare
…re tests Problem: The tests replaced the client class with `lambda project=None: mock_client`. A lambda only accepts that one keyword, so the test would break for reasons unrelated to the sample if the constructor call changed, and it records nothing, so the tests could not verify how the client was created. Solution: Patch the client class with `mock.MagicMock(return_value=mock_client)` and assert in the success test that the sample constructed it exactly once with the expected arguments.
…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:
create_procedure(project_id: str, dataset_id: str) -> Noneinbigquery/stored_procedures/bigquery_create_procedure.py(Create a reusable multi-statement GoogleSQL stored procedure inside a BigQuery dataset using CREATE PROCEDURE.)bigquery/stored_procedures/bigquery_create_procedure_test.py) covering both the success path and API error handling (GoogleAPICallError)Description
Fixes #
Checklist
Testing
Compliance & Style
Post-Approval Actions