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


##########
airflow/api/common/mark_tasks.py:
##########
@@ -148,10 +148,10 @@ def set_state(
     qry_dag = get_all_dag_task_query(dag, session, state, 
task_id_map_index_list, dag_run_ids)
 
     if commit:
-        tis_altered = qry_dag.with_for_update().all()
+        tis_altered = 
session.execute(qry_dag.with_for_update()).scalars().all()
         if sub_dag_run_ids:
             qry_sub_dag = all_subdag_tasks_query(sub_dag_run_ids, session, 
state, confirmed_dates)
-            tis_altered += qry_sub_dag.with_for_update().all()
+            tis_altered += 
session.execute(qry_sub_dag.with_for_update()).scalars().all()

Review Comment:
   ```suggestion
               tis_altered += 
session.scalars(qry_sub_dag.with_for_update()).all()
   ```
   
   I’m not quite sure but the docs seem to suggest this is superior…?
   
   
https://docs.sqlalchemy.org/en/20/orm/queryguide/select.html#selecting-orm-entities
   
   > This is most easily achieved by using the Session.scalars() method to 
execute, rather than the Session.execute()



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