You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by vi...@apache.org on 2025/10/27 13:33:05 UTC
(airflow) branch main updated: SQLA2: fix mypy violations in common/parameters.py (#57248)
This is an automated email from the ASF dual-hosted git repository.
vincbeck pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 8a03e505261 SQLA2: fix mypy violations in common/parameters.py (#57248)
8a03e505261 is described below
commit 8a03e5052613867eb8f79b992da8379325000cbf
Author: Dev-iL <65...@users.noreply.github.com>
AuthorDate: Mon Oct 27 15:32:58 2025 +0200
SQLA2: fix mypy violations in common/parameters.py (#57248)
---
airflow-core/src/airflow/api_fastapi/common/parameters.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/airflow-core/src/airflow/api_fastapi/common/parameters.py b/airflow-core/src/airflow/api_fastapi/common/parameters.py
index b7abf568c59..30639fdee58 100644
--- a/airflow-core/src/airflow/api_fastapi/common/parameters.py
+++ b/airflow-core/src/airflow/api_fastapi/common/parameters.py
@@ -228,7 +228,7 @@ class SortParam(BaseParam[list[str]]):
f"Ordering with more than {self.MAX_SORT_PARAMS} parameters is not allowed. Provided: {order_by_values}",
)
- columns: list[Column] = []
+ columns: list[ColumnElement] = []
for order_by_value in order_by_values:
lstriped_orderby = order_by_value.lstrip("-")
column: Column | None = None
@@ -506,7 +506,7 @@ class _DagIdAssetReferenceFilter(BaseParam[list[str]]):
"""Search on dag_id."""
def __init__(self, skip_none: bool = True) -> None:
- super().__init__(AssetModel.scheduled_dags, skip_none)
+ super().__init__(skip_none=skip_none)
@classmethod
def depends(cls, dag_ids: list[str] = Query(None)) -> _DagIdAssetReferenceFilter:
@@ -518,10 +518,13 @@ class _DagIdAssetReferenceFilter(BaseParam[list[str]]):
def to_orm(self, select: Select) -> Select:
if self.value is None and self.skip_none:
return select
+
+ # At this point, self.value is either a list[str] or None -> coerce falsy None to an empty list
+ dag_ids = self.value or []
return select.where(
- (AssetModel.scheduled_dags.any(DagScheduleAssetReference.dag_id.in_(self.value)))
- | (AssetModel.producing_tasks.any(TaskOutletAssetReference.dag_id.in_(self.value)))
- | (AssetModel.consuming_tasks.any(TaskInletAssetReference.dag_id.in_(self.value)))
+ (AssetModel.scheduled_dags.any(DagScheduleAssetReference.dag_id.in_(dag_ids)))
+ | (AssetModel.producing_tasks.any(TaskOutletAssetReference.dag_id.in_(dag_ids)))
+ | (AssetModel.consuming_tasks.any(TaskInletAssetReference.dag_id.in_(dag_ids)))
)