prabhusneha commented on code in PR #45420:
URL: https://github.com/apache/airflow/pull/45420#discussion_r1921611036
##########
airflow/api_fastapi/common/db/dags.py:
##########
@@ -17,31 +17,40 @@
from __future__ import annotations
+from typing import TYPE_CHECKING
+
from sqlalchemy import func, select
+if TYPE_CHECKING:
+ from sqlalchemy.sql import Select
+
from airflow.models.dag import DagModel
from airflow.models.dagrun import DagRun
-latest_dag_run_per_dag_id_cte = (
- select(DagRun.dag_id, func.max(DagRun.start_date).label("start_date"))
- .where()
- .group_by(DagRun.dag_id)
- .cte()
-)
-
-dags_select_with_latest_dag_run = (
- select(DagModel)
- .join(
- latest_dag_run_per_dag_id_cte,
- DagModel.dag_id == latest_dag_run_per_dag_id_cte.c.dag_id,
- isouter=True,
+def generate_dag_select_query(
+ stmt: Select = select(DagRun).where().cte(), use_outer_join: bool = True
+) -> Select:
+ latest_dag_run_per_dag_id_cte = (
+ select(stmt.c.dag_id, func.max(stmt.c.start_date).label("start_date"))
Review Comment:
Modified the name.
--
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]