Skip to content

Eager-load DagCode in the Dag source API #73716

Closed

Description

@dilnazanlid

Description

GET /dags/{dag_id}/dagSources loads the DagVersion first. The dag_code
relationship is lazy, so reading dag_version.dag_code sends a second query.
Loading dag_code together with the version (e.g. via joinedload) would
avoid that extra database round trip.

Use case/motivation

One query instead of two for each Dag source request. The change affects both
the model layer (DagVersion.get_version) and the API route, so it needs its
own PR.

Related issues

Follow-up from review of #72474.

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:feature
    needs-triage
    on Sep 25, 2026
  2. added a commit that references this issue on Sep 26, 2026
    1219b1a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:featureneeds-triage

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions