uranusjr commented on code in PR #34665:
URL: https://github.com/apache/airflow/pull/34665#discussion_r1343831841


##########
airflow/dag_processing/manager.py:
##########
@@ -526,13 +527,11 @@ def deactivate_stale_dags(
         Deactivate them and remove them in the serialized_dag table.
         """
         to_deactivate = set()
-        query = session.query(DagModel.dag_id, DagModel.fileloc, 
DagModel.last_parsed_time).filter(
-            DagModel.is_active
-        )
+        query = select(DagModel.dag_id, DagModel.fileloc, 
DagModel.last_parsed_time).where(DagModel.is_active)
         standalone_dag_processor = conf.getboolean("scheduler", 
"standalone_dag_processor")
         if standalone_dag_processor:
-            query = query.filter(DagModel.processor_subdir == dag_directory)
-        dags_parsed = query.all()
+            query = query.where(DagModel.processor_subdir == dag_directory)
+        dags_parsed = session.execute(query)

Review Comment:
   Current code in PR is correct. The `.all()` part in the previous query is 
superfulous since `dags_parsed` is simply iterated over. So the new code does 
not need `.all()` either.
   
   We also don’t want `.scalars()` here since we are selecting multiple fields 
and do want a Row object instead of scalars.



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to