justinpakzad commented on code in PR #63665:
URL: https://github.com/apache/airflow/pull/63665#discussion_r3025204267
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/dags.py:
##########
@@ -356,7 +362,26 @@ def patch_dags(
session=session,
)
dags = session.scalars(dags_select).all()
- dags_to_update = {dag.dag_id for dag in dags}
+ dags_to_update: set[str] = set()
+
+ for current_offset in range(0, total_entries, limit.value): # type:
ignore[arg-type]
+ dags_select, _ = paginated_select(
+ statement=select(DagModel.dag_id),
+ filters=[
+ exclude_stale,
+ paused,
+ dag_id_pattern,
+ tags,
+ owners,
+ editable_dags_filter,
+ ],
+ order_by=None,
+ offset=QueryOffset.depends(current_offset),
+ limit=limit,
+ session=session,
+ )
+ dags_to_update.update(session.scalars(dags_select).all())
Review Comment:
Yea, definitely a better approach, thanks for pointing that out! MySQL was
throwing an error because of the sub query (can't update and reference that
same table in a subquery) so I modified it slightly to
`.where(DagModel.dag_id.in_(select(filtered_dag_ids.c.dag_id)))` to make it
work.
--
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]