ephraimbuddy commented on code in PR #60937:
URL: https://github.com/apache/airflow/pull/60937#discussion_r2716789923


##########
airflow-core/src/airflow/models/serialized_dag.py:
##########
@@ -520,7 +520,16 @@ def write_dag(
             log.debug("Serialized DAG (%s) is unchanged. Skipping writing to 
DB", dag.dag_id)
             return False
 
-        if dag_version and not dag_version.task_instances:
+        has_task_instances = False
+        if dag_version:
+            has_task_instances = (
+                session.scalar(
+                    
select(literal(True)).where(exists().where(TaskInstance.dag_version_id == 
dag_version.id))
+                )
+                or False
+            )

Review Comment:
   ```suggestion
               has_task_instances = session.scalar(
                   select(exists().where(TaskInstance.dag_version_id == 
dag_version.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