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


##########
airflow/api/common/mark_tasks.py:
##########
@@ -361,7 +358,9 @@ def _set_dag_run_state(dag_id: str, run_id: str, state: 
DagRunState, session: SA
     :param state: target state
     :param session: database session
     """
-    dag_run = session.query(DagRun).filter(DagRun.dag_id == dag_id, 
DagRun.run_id == run_id).one()
+    dag_run = session.execute(
+        select(DagRun).where(DagRun.dag_id == dag_id, DagRun.run_id == run_id)
+    ).scalar_one()

Review Comment:
   Should be equivalent to
   
   ```suggestion
       dag_run = session.scalars(
           select(DagRun).where(DagRun.dag_id == dag_id, DagRun.run_id == 
run_id)
       ).one()
   ```
   
   but I _don’t_ think this is better. So just for reference in case anyone 
wonders.



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