Repository navigation
Conversation
Co-authored-by: Codex gpt-6.1-sol <[email protected]>
There was a problem hiding this comment.
📋 Review Summary
This PR adds bigquery_job_labels support to Python's WriteToBigQuery transform for FILE_LOADS, propagating user-provided labels alongside Beam's metadata labels to load, copy, and schema-update BigQuery jobs. It also validates that non-empty bigquery_job_labels are rejected for write methods that do not create BigQuery jobs (STREAMING_INSERTS and STORAGE_WRITE_API), and includes unit tests covering Runner API serialization, method validation, and label propagation across all job types.
🔍 General Feedback
- Passing
self.bigquery_job_labels.copy()toadd_additional_bq_job_labels()inUpdateDestinationSchema,TriggerCopyJobs, andTriggerLoadJobscleanly avoids mutating the shared dictionary on theDoFninstances. - The implementation and unit tests are thorough, well-structured, and ready to merge.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
|
Assigning reviewers: R: @damccorm for label python. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
damccorm
left a comment
There was a problem hiding this comment.
Thanks - this LGTM, just had one small comment
|
|
||
| * X feature added (Java/Python) ([#X](https://github.com/apache/beam/issues/X)). |
There was a problem hiding this comment.
Nit: please remove the trailing space and the placeholder item
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41470 +/- ##
============================================
- Coverage 58.77% 58.67% -0.11%
Complexity 2292 2292
============================================
Files 1134 1134
Lines 170223 170230 +7
Branches 1487 1487
============================================
- Hits 100049 99878 -171
- Misses 67630 67808 +178
Partials 2544 2544
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for the review, @damccorm . My org's internal review of this contribution may take a little longer over Thanksgiving, but I’ll follow up as soon as it’s complete. Appreciate if this could be hold. |
Co-authored-by: Codex gpt-6.1-sol <[email protected]>
Python
ReadFromBigQueryaccepts BigQuery job labels, butWriteToBigQuerydoes not.This adds the same
bigquery_job_labelsoption for load, copy, and schema-update jobs created byWriteToBigQuery, with methodFILE_LOADS.Notes
FILE_LOADSsince BigQuery does not support job labels for the only other two write methods -STREAMING_INSERTS, andSTORAGE_WRITE_API.bigquery_job_labelsto either unsupported method raisesValueError. Docstring explains this restriction.ReadFromBigQuery.Validation
(1) Ran this version locally against real BigQuery and confirmed the job labels work.
(2) From
sdks/python, after the Python development setup:pytest -q apache_beam/io/gcp/bigquery_test.py apache_beam/io/gcp/bigquery_file_loads_test.py -k "bigquery_job_labels or to_from_runner_api"