kaxil commented on code in PR #69542:
URL: https://github.com/apache/airflow/pull/69542#discussion_r3537473289


##########
providers/google/src/airflow/providers/google/cloud/operators/bigquery.py:
##########
@@ -2351,6 +2378,11 @@ def __init__(
         self.configuration = configuration
         self.location = location
         self.job_id = job_id
+        # self.job_id is reassigned to the actual submitted/fetched job's id 
as execution
+        # proceeds (see _persist_job_links); this keeps the user's original 
input around so
+        # submit_job always computes ids from it, not from a job id set by an 
earlier
+        # get_job_status call in the same attempt (e.g. on a durable 
terminal_resubmit).
+        self._configured_job_id = job_id

Review Comment:
   `_configured_job_id` is captured here in `__init__` from the raw constructor 
arg, but `job_id` is a template field (line 2346). Template rendering runs 
after `__init__` and only overwrites `self.job_id`, never 
`self._configured_job_id`. Since `submit_job` now feeds 
`generate_job_id(job_id=self._configured_job_id, ...)`, a templated `job_id` 
such as `"report_{{ ds_nodash }}"` reaches `generate_job_id` unrendered -- the 
pre-PR code passed the rendered `self.job_id`, so this regresses templating of 
`job_id` (the literal `{{ }}` is also an invalid BigQuery job id).
   
   Snapshot the original id after templating (e.g. at the start of 
`execute`/`execute_resumable`) rather than in `__init__`, or add 
`_configured_job_id` to `template_fields`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to