You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Airflow ingestion fires N extra DB queries (one per DAG) to fetch is_paused inside get_pipelines_list #27148
Inside AirflowSource.get_pipelines_list(), every DAG row returned by the paginated main query triggers an additional SELECT is_paused FROM dag WHERE dag_id = ? lookup against the Airflow metadata database:
# Inside "for serialized_dag in results:" — fires once per DAGis_paused_result= (
self.session.query(DagModel.is_paused)
.filter(DagModel.dag_id==serialized_dag[0])
.scalar()
)
For an Airflow installation with 500 DAGs this produces 500 extra round-trips per ingestion run, in addition to the main paginated query. The overhead scales linearly with the number of DAGs and is entirely avoidable: DagModel is already referenced in the query's FROM clause (or can be with a simple LEFT OUTER JOIN) so is_paused can be selected as a column in the main query and read directly from the result row.
To Reproduce
Connect OpenMetadata ingestion to an Airflow database with ≥ 100 DAGs.
Enable SQL query logging on the Airflow metadata database.
Run the Airflow ingestion pipeline.
Observe one SELECT dag.is_paused FROM dag WHERE dag.dag_id = ? per DAG, in addition to the paginated serialized_dag query.
Expected behavior
is_paused should be fetched as part of the main paginated query with zero additional round-trips. For N DAGs the method should issue at most ceil(N / 100) paginated queries.
Airflow 3.x path (no fileloc on SerializedDagModel): DagModel is already joined for fileloc; add DagModel.is_paused to the column list.
Airflow 2.x + includeUnDeployedPipelines=False path: DagModel is already in the FROM clause via select_from(join(...)); add DagModel.is_paused to the column list.
Airflow 2.x + includeUnDeployedPipelines=True path: DagModel is not yet joined; add a LEFT OUTER JOIN to DagModel on dag_id and select DagModel.is_paused.
In all cases the per-row inner query is then replaced by reading serialized_dag[3] (the new is_paused column position).
Activity