Repository navigation
feat(bigquery): add bigquery_multi_statement_transaction sample to ru… - #14720
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 BigQuery sample demonstrating how to execute a multi-statement SQL transaction with exception rollback handling using the Python client, along with corresponding unit tests and configuration files. The feedback suggests updating the ignored_versions in noxfile_config.py to ensure only the oldest and newest supported Python versions (3.10 and 3.13) are tested, ignoring intermediate versions like 3.11 and 3.12.
XrossFox
left a comment
There was a problem hiding this comment.
Code looks good to me, but a dependency on the requirements file is outdated.
| @@ -0,0 +1 @@ | |||
| google-cloud-bigquery==3.35.1 | |||
There was a problem hiding this comment.
This version of bigquery is over a year old, most recent version is 3.47.0
0e3fccb to
e0a4a27
Compare
…n a multi-statement transaction with rollback Problem: The BigQuery documentation (https://cloud.google.com/bigquery/docs/transactions#example_of_a_transaction) needs a standalone, tested Python code sample demonstrating how to run a multi-statement transaction with rollback (region tag `bigquery_multi_statement_transaction`). Solution: - Add `run_multi_statement_transaction(project_id: str, dataset_id: str, source_table_id: str, target_table_id: str) -> None` in `bigquery/transactions/bigquery_multi_statement_transaction.py` (Execute a multi-statement GoogleSQL transaction across BigQuery tables using BEGIN TRANSACTION, COMMIT TRANSACTION, and EXCEPTION WHEN ERROR THEN ROLLBACK TRANSACTION.) - Add unit tests (`bigquery/transactions/bigquery_multi_statement_transaction_test.py`) covering both the success path and API error handling (`GoogleAPICallError`)
e0a4a27 to
abc43fd
Compare
…n a multi-statement transaction with rollback
Problem:
The BigQuery documentation (https://cloud.google.com/bigquery/docs/transactions#example_of_a_transaction) needs a standalone, tested Python code sample demonstrating how to run a multi-statement transaction with rollback (region tag
bigquery_multi_statement_transaction).Solution:
run_multi_statement_transaction(project_id: str, dataset_id: str, source_table_id: str, target_table_id: str) -> Noneinbigquery/transactions/bigquery_multi_statement_transaction.py(Execute a multi-statement GoogleSQL transaction across BigQuery tables using BEGIN TRANSACTION, COMMIT TRANSACTION, and EXCEPTION WHEN ERROR THEN ROLLBACK TRANSACTION.)bigquery/transactions/bigquery_multi_statement_transaction_test.py) covering both the success path and API error handling (GoogleAPICallError)Checklist
Testing
Compliance & Style
Post-Approval Actions