Taragolis commented on code in PR #35339: URL: https://github.com/apache/airflow/pull/35339#discussion_r1379070387
########## 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: > But if no DagPickle object is found, then calling the limit() method will still throw an Exception Nope, this one is transformed to a single query `select(DagPickle).where(DagPickle.id == pickle_id).limit(1)` Which would transformed to something like ```sql SELECT * FROM dag_pickle WHERE id = 42 LIMIT 1 ``` -- 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