diff --git a/airflow/sensors/external_task.py b/airflow/sensors/external_task.py
index <HASH>..<HASH> 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
Fix tests for mssql after SQLA <I> upgrade (#<I>)

The way SQLA <I> 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.