aneesh-joseph commented on a change in pull request #9973:
URL: https://github.com/apache/airflow/pull/9973#discussion_r628835005



##########
File path: airflow/models/dagcode.py
##########
@@ -147,7 +148,7 @@ def has_dag(cls, fileloc: str, session=None) -> bool:
         :param session: ORM Session
         """
         fileloc_hash = cls.dag_fileloc_hash(fileloc)
-        return session.query(exists().where(cls.fileloc_hash == 
fileloc_hash)).scalar()
+        return session.query(literal(True)).filter(cls.fileloc_hash == 
fileloc_hash).one_or_none() is not None

Review comment:
       `return session.query(literal(True)).filter(cls.fileloc_hash == 
fileloc_hash).first() is not None`
   instead of 
   `return session.query(literal(True)).filter(cls.fileloc_hash == 
fileloc_hash).one_or_none() is not None` ?
   
   I mean is it expected to have multiple duplicate fileloc_hash ?




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

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


Reply via email to