nailo2c commented on code in PR #69234:
URL: https://github.com/apache/airflow/pull/69234#discussion_r3558149780


##########
providers/google/src/airflow/providers/google/cloud/openlineage/mixins.py:
##########
@@ -109,14 +110,50 @@ def get_openlineage_facets_on_complete(self, _):
             run_facets["bigQueryJob"] = 
self._get_bigquery_job_run_facet(job_properties)
 
             if get_from_nullable_chain(job_properties, ["statistics", 
"numChildJobs"]):
-                self.log.debug("Found SCRIPT job. Extracting lineage from 
child jobs instead.")
-                # SCRIPT job type has no input / output information but spawns 
child jobs that have one
+                self.log.debug("Found SCRIPT job. Extracting lineage from 
child jobs.")
+                # SCRIPT job has no input/output of its own but spawns child 
jobs that do. The parent
+                # task keeps the aggregated coarse-grained lineage (backward 
compatible) while each
+                # child query is additionally emitted below as its own event 
for per-statement detail.
                 # 
https://cloud.google.com/bigquery/docs/information-schema-jobs#multi-statement_query_job
-                for child_job_id in 
self._client.list_jobs(parent_job=self.job_id):
-                    child_job_properties = 
self._client.get_job(job_id=child_job_id)._properties
-                    child_inputs, child_outputs = 
self._get_inputs_and_outputs(child_job_properties)
+                child_jobs_to_emit = []
+                for child_job in 
self._client.list_jobs(parent_job=self.job_id):
+                    # BigQuery returns Job objects; keep raw job IDs supported 
for lightweight clients.
+                    child_job_id = getattr(child_job, "job_id", child_job)

Review Comment:
   I checked the official docs and it says it's job_instances.
   
https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.client.Client#google_cloud_bigquery_client_Client_list_jobs
   
   I think the old loop work because client.get_job() accepts both job_id and 
job_instance, I just think use child_job is more matching docs.



-- 
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