Skip to content

Commit ff467e7

Browse files
committed
fix: mypy error in dagrun.py
1 parent 302bb4f commit ff467e7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

airflow-core/src/airflow/models/dagrun.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@
9898

9999
from opentelemetry.sdk.trace import Span
100100
from pydantic import NonNegativeInt
101-
from sqlalchemy.orm import Query, Session
101+
from sqlalchemy.engine import ScalarResult
102+
from sqlalchemy.orm import Session
102103
from sqlalchemy.sql.elements import Case, ColumnElement
103104

104105
from airflow.models.dag_version import DagVersion
@@ -572,11 +573,11 @@ def active_runs_of_dags(
572573
)
573574
if exclude_backfill:
574575
query = query.where(cls.run_type != DagRunType.BACKFILL_JOB)
575-
return dict(session.execute(query).all())
576+
return {dag_id: count for dag_id, count in session.execute(query)}
576577

577578
@classmethod
578579
@retry_db_transaction
579-
def get_running_dag_runs_to_examine(cls, session: Session) -> Query:
580+
def get_running_dag_runs_to_examine(cls, session: Session) -> ScalarResult[DagRun]:
580581
"""
581582
Return the next DagRuns that the scheduler should attempt to schedule.
582583
@@ -615,7 +616,7 @@ def get_running_dag_runs_to_examine(cls, session: Session) -> Query:
615616

616617
@classmethod
617618
@retry_db_transaction
618-
def get_queued_dag_runs_to_set_running(cls, session: Session) -> Query:
619+
def get_queued_dag_runs_to_set_running(cls, session: Session) -> ScalarResult[DagRun]:
619620
"""
620621
Return the next queued DagRuns that the scheduler should attempt to schedule.
621622

0 commit comments

Comments
 (0)