Skip to content

Commit

Permalink
IN with constants is likely better than OR
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Sep 19, 2024
1 parent d1862e6 commit 7d1e961
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions airflow/dag_processing/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import logging
from typing import TYPE_CHECKING, NamedTuple

from sqlalchemy import func, or_, select
from sqlalchemy import func, select
from sqlalchemy.orm import joinedload, load_only
from sqlalchemy.sql import expression

Expand Down Expand Up @@ -111,7 +111,7 @@ def _get_latest_runs_stmt(dag_ids: Collection[str]) -> Select:
select(func.max(DagRun.execution_date).label("max_execution_date"))
.where(
DagRun.dag_id == dag_id,
or_(DagRun.run_type == DagRunType.BACKFILL_JOB, DagRun.run_type == DagRunType.SCHEDULED),
DagRun.run_type.in_((DagRunType.BACKFILL_JOB, DagRunType.SCHEDULED)),
)
.scalar_subquery()
)
Expand Down

0 comments on commit 7d1e961

Please sign in to comment.