kaxil commented on a change in pull request #8232: Simplify
DAG.set_dag_runs_state method
URL: https://github.com/apache/airflow/pull/8232#discussion_r406369525
##########
File path: airflow/models/dag.py
##########
@@ -912,12 +912,7 @@ def set_dag_runs_state(
query = query.filter(DagRun.execution_date >= start_date)
if end_date:
query = query.filter(DagRun.execution_date <= end_date)
- drs = query.all()
-
- dirty_ids = []
- for dr in drs:
- dr.state = state
- dirty_ids.append(dr.dag_id)
+ query.update({DagRun.state: state})
Review comment:
I guess yes based on
https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.update
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services