This is an automated email from the ASF dual-hosted git repository.

ash pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new baf50cd  Fix tests for mssql after SQLA 1.4 upgrade (#21303)
baf50cd is described below

commit baf50cddd86ac07f064c8cbd95efb22d038b3832
Author: Ash Berlin-Taylor <[email protected]>
AuthorDate: Thu Feb 3 20:24:25 2022 +0000

    Fix tests for mssql after SQLA 1.4 upgrade (#21303)
    
    The way SQLA 1.4 constructed the query then `exeuction_date.in_([])`
    changed, and as a result it started failing.
    
    But we don't even need to ask the database in this case, as we know it
    won't return any rows.
---
 airflow/sensors/external_task.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/airflow/sensors/external_task.py b/airflow/sensors/external_task.py
index f1e3544..6ab6cff 100644
--- a/airflow/sensors/external_task.py
+++ b/airflow/sensors/external_task.py
@@ -215,6 +215,9 @@ class ExternalTaskSensor(BaseSensorOperator):
         """
         TI = TaskInstance
         DR = DagRun
+        if not dttm_filter:
+            return 0
+
         if self.external_task_ids:
             count = (
                 session.query(func.count())  # .count() is inefficient

Reply via email to