Remove transaction for bigquery in delete_and_insert macro
Solves https://github.com/elementary-data/elementary/issues/1766
Summary by CodeRabbit
-
New Features
- Added BigQuery support for more flexible data update operations with conditional delete and insert logic for improved data management.
Walkthrough
A new BigQuery-specific macro has been added to construct and return delete and insert queries with conditional logic. The macro accepts parameters for the target relation, insert relation, delete relation, and delete column key, accumulating the appropriate queries based on which relations are provided.
Changes
| Cohort / File(s) | Summary |
|---|---|
BigQuery delete and insert queries macro macros/utils/table_operations/delete_and_insert.sql |
Added bigquery__get_delete_and_insert_queries(relation, insert_relation, delete_relation, delete_column_key) macro that conditionally constructs delete queries when delete_relation is provided and insert queries when insert_relation is provided, returning the accumulated query list. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
- Verify SQL syntax for delete and insert query construction
- Confirm conditional logic correctly evaluates the presence of
delete_relationandinsert_relation - Check parameter usage and ensure
delete_column_keyis properly utilized in delete conditions
Poem
A rabbit hops through queries new, ✨ Delete then insert, tried and true, BigQuery dances left and right, With conditional logic shining bright! 🐰
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The PR title 'Remove transaction for bigquery in delete_and_insert macro' accurately describes the main change: removing transaction handling from the BigQuery delete_and_insert macro. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✨ Finishing touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📥 Commits
Reviewing files that changed from the base of the PR and between 2c599d18b9c70f34596cb804030c19eb5d02b585 and 044d5a8e4cdd06ac11ce4dc021d1e49cfcfdb528.
📒 Files selected for processing (1)
-
macros/utils/table_operations/delete_and_insert.sql(1 hunks)
🔇 Additional comments (1)
macros/utils/table_operations/delete_and_insert.sql (1)
136-157: Implementation correctly removes transaction wrapper for BigQuery.The macro properly constructs separate delete and insert queries without wrapping them in a transaction, which aligns with BigQuery's DML semantics and addresses the issue raised in #1766.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.