syedahsn commented on code in PR #35339:
URL: https://github.com/apache/airflow/pull/35339#discussion_r1379043315


##########
airflow/utils/cli.py:
##########
@@ -269,7 +269,7 @@ def get_dag_by_pickle(pickle_id: int, session: Session = 
NEW_SESSION) -> DAG:
     """Fetch DAG from the database using pickling."""
     from airflow.models import DagPickle
 
-    dag_pickle = session.scalar(select(DagPickle).where(DagPickle.id == 
pickle_id)).first()
+    dag_pickle = session.scalar(select(DagPickle).where(DagPickle.id == 
pickle_id).limit(1))

Review Comment:
   If one of the errors you saw was `AttributeError: None object has no 
attribute 'first'`, then this change could still produce that error, as long as 
`session.scalar(select(DagPickle).where(DagPickle.id == pickle_id)` returns 
`None`. Maybe it would be better to check for `None` before calling something 
on it



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