Skip to content

Airflow ingestion fires N extra DB queries (one per DAG) to fetch is_paused inside get_pipelines_list #27148

Description

@RajdeepKushwaha5

Affected module
Ingestion Framework — openmetadata-ingestion, Airflow pipeline connector (metadata/ingestion/source/pipeline/airflow/metadata.py)

Describe the bug

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

  1. Connect OpenMetadata ingestion to an Airflow database with ≥ 100 DAGs.
  2. Enable SQL query logging on the Airflow metadata database.
  3. Run the Airflow ingestion pipeline.
  4. 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.

Version:

  • Python version: 3.10 / 3.11
  • OpenMetadata version: 1.6.x / 1.7.x
  • OpenMetadata Ingestion package version: openmetadata-ingestion[airflow]

Additional context

The fix is straightforward:

  • 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

  1. added theissue type on Apr 8, 2026
  2. self-assigned this
    on Aug 23, 2026
  3. moved this to Triage 🧐 in Shippingon Aug 23, 2026
  4. moved this from Triage 🧐 to In Progress 🏗️ in Shippingon Aug 24, 2026
  5. moved this from In Progress 🏗️ to In Review / QA 👀 in Shippingon Aug 24, 2026
  6. moved this from In Review / QA 👀 to Done ✅ in Shippingon Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

  • Status
    Done ✅

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions