SamWheating commented on code in PR #34018:
URL: https://github.com/apache/airflow/pull/34018#discussion_r1313471122


##########
airflow/providers/google/cloud/operators/bigquery.py:
##########
@@ -443,6 +443,10 @@ def execute(self, context: Context) -> None:  # type: 
ignore[override]
                     method_name="execute_complete",
                 )
             self._handle_job_error(job)
+            # job.result() returns a RowIterator. Mypy expects an instance of 
SupportsNext[Any] for
+            # the next() call which the RowIterator does not resemble to. 
Hence, ignore the arg-type error.
+            records = next(job.result())  # type: ignore[arg-type]
+            self.check_value(records)

Review Comment:
   If we're checking the values here, can we remove the `check_value` call in 
the `BigQueryValueCheckTrigger`?
   
   
https://github.com/apache/airflow/blob/81b85ebcbd241e1909793d7480aabc81777b225c/airflow/providers/google/cloud/triggers/bigquery.py#L441
   
   I'm not really sure why the check_value there wasn't picking up the failed 
status 🤔 I'd assume that if the check failed it would raise an exception which 
would then be caught and returned as a failed trigger status:
   
   
https://github.com/apache/airflow/blob/81b85ebcbd241e1909793d7480aabc81777b225c/airflow/providers/google/cloud/triggers/bigquery.py#L451-L454



##########
airflow/providers/google/cloud/operators/bigquery.py:
##########
@@ -443,6 +443,10 @@ def execute(self, context: Context) -> None:  # type: 
ignore[override]
                     method_name="execute_complete",
                 )
             self._handle_job_error(job)
+            # job.result() returns a RowIterator. Mypy expects an instance of 
SupportsNext[Any] for
+            # the next() call which the RowIterator does not resemble to. 
Hence, ignore the arg-type error.
+            records = next(job.result())  # type: ignore[arg-type]
+            self.check_value(records)

Review Comment:
   If we're checking the values here, can we remove the `check_value` call in 
the `BigQueryValueCheckTrigger`?
   
   
https://github.com/apache/airflow/blob/81b85ebcbd241e1909793d7480aabc81777b225c/airflow/providers/google/cloud/triggers/bigquery.py#L441
   
   I'm not really sure why the check_value there wasn't picking up the failed 
status 🤔 I'd assume that if the check failed it would raise an exception which 
would then be caught and returned as a failed trigger status:
   
   
https://github.com/apache/airflow/blob/81b85ebcbd241e1909793d7480aabc81777b225c/airflow/providers/google/cloud/triggers/bigquery.py#L451-L454



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