kaxil commented on code in PR #48651:
URL: https://github.com/apache/airflow/pull/48651#discussion_r2029791979
##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/dag_runs.py:
##########
@@ -150,3 +152,27 @@ def get_dagrun_state(
)
return DagRunStateResponse(state=dag_run.state)
+
+
[email protected]("/count", status_code=status.HTTP_200_OK)
+def get_dr_count(
+ dag_id: str,
+ session: SessionDep,
+ logical_dates: Annotated[list[UtcDateTime] | None, Query()] = None,
+ run_ids: Annotated[list[str] | None, Query()] = None,
+ states: Annotated[list[str] | None, Query()] = None,
+) -> int:
+ """Get the count of DAG runs matching the given criteria."""
+ query = select(func.count()).select_from(DagRun).where(DagRun.dag_id ==
dag_id)
+
+ if logical_dates:
+ query = query.where(DagRun.logical_date.in_(logical_dates))
+
+ if run_ids:
+ query = query.where(DagRun.run_id.in_(run_ids))
+
+ if states:
+ query = query.where(DagRun.state.in_(states))
+
+ count = session.scalar(query)
+ return count or 0
Review Comment:
I just had a chat with the Cadwyn Author ( @zmievsa ) who recommends to
only add it for breaking changes.
> Depending on your needs. My general recommendation is to only add
migrations for breaking changes
https://docs.cadwyn.dev/how_to/change_endpoints/#add-a-new-endpoint
--
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]