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


##########
airflow/models/dagcode.py:
##########
@@ -170,7 +128,12 @@ def has_dag(cls, fileloc: str, session: Session = 
NEW_SESSION) -> bool:
         """
         fileloc_hash = cls.dag_fileloc_hash(fileloc)
         return (
-            session.scalars(select(literal(True)).where(cls.fileloc_hash == 
fileloc_hash)).one_or_none()
+            session.scalars(
+                select(literal(True))
+                .where(cls.fileloc_hash == fileloc_hash)
+                .order_by(cls.last_updated.desc())

Review Comment:
   I removed the order_by and added a test for multiple rows, which the 
limit(1) helps stop



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