pierrejeambrun commented on code in PR #45420:
URL: https://github.com/apache/airflow/pull/45420#discussion_r1906906917


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

Review Comment:
   Function name should be improved. That does not just generate `any` 
dag_select query. But a very specific one. Name should be more descriptive 
there is no idea of what we are trying to generate, we need to read at the code 
to understand.



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