ashb commented on a change in pull request #17030:
URL: https://github.com/apache/airflow/pull/17030#discussion_r703303982



##########
File path: airflow/utils/db.py
##########
@@ -674,30 +673,73 @@ def check_conn_type_null(session=None) -> str:
         pass
 
     if n_nulls:
-        return (
+        yield (
             'The conn_type column in the connection '
             'table must contain content.\n'
             'Make sure you don\'t have null '
             'in the conn_type column.\n'
             f'Null conn_type conn_id: {list(n_nulls)}'
         )
-    return ''
+
+
+def check_task_tables_without_matching_dagruns(session) -> Iterable[str]:
+    from itertools import chain
+
+    import sqlalchemy.schema
+    from sqlalchemy import and_, outerjoin
+
+    from airflow.models.renderedtifields import RenderedTaskInstanceFields
+    from airflow.models.sensorinstance import SensorInstance
+
+    metadata = sqlalchemy.schema.MetaData(session.bind)
+    models_to_dagrun = [TaskInstance, TaskFail, TaskReschedule]
+    models_to_ti = [
+        RenderedTaskInstanceFields,
+        SensorInstance,
+        SlaMiss,
+        XCom,
+    ]

Review comment:
       Right now we've only done TaskInstance and TaskReschedule -- I should 
probably remove the others now, as otherwise anytime you ran` airflow db 
upgrade` etc it would re-check those tables (as the short-circuit on line 707 
wouldn't trigger)
   
   ```suggestion
       models_to_dagrun = [TaskInstance, TaskFail]
       models_to_ti = []
   ```




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