bhirsz commented on code in PR #26768:
URL: https://github.com/apache/airflow/pull/26768#discussion_r983170056


##########
airflow/providers/google/cloud/transfers/gcs_to_bigquery.py:
##########
@@ -319,9 +319,10 @@ def execute(self, context: Context):
                     location=self.location,
                     use_legacy_sql=False,
                 )
-            row = list(bq_hook.get_job(job_id=job_id, 
location=self.location).result())
-            if row:
-                max_id = row[0] if row[0] else 0
+            result = bq_hook.get_job(job_id=job_id, 
location=self.location).result()
+            row = next(iter(result), None)
+            if row is not None:

Review Comment:
   nit: You can reverse if for smaller indent:
   ```
   if row is None:
       raise RuntimeError(f"The {select_command} returned no rows!")
   max_id = row[0]
   self.log.info(
       'Loaded BQ data with max %s.%s=%s',
       self.destination_project_dataset_table,
       self.max_id_key,
       max_id,
   )
   return max_id
   ```



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