KoviAnusha commented on code in PR #57466:
URL: https://github.com/apache/airflow/pull/57466#discussion_r2476283322
##########
airflow-core/src/airflow/api_fastapi/common/db/dag_runs.py:
##########
@@ -23,11 +23,11 @@
from airflow.models.dagrun import DagRun
dagruns_select_with_state_count = (
- select(
+ select( # type: ignore[call-overload]
Review Comment:
Yes, this is a limitation in SQLAlchemy 2.0's type declarations. It only
defines overloads for up to 10 specific parameter combinations. It can't handle
the complex mix of InstrumentedAttribute, func.count(), and .label()
expressions we're using, even though it's perfectly valid SQLAlchemy code that
works at runtime.
I tried using the below (unpacking approach)
dagruns_select_with_state_count = (
**select(*[**
DagRun.dag_id,
DagRun.state,
DagModel.dag_display_name,
func.count(DagRun.state).label("count"),
])
.join(DagModel, DagRun.dag_id == DagModel.dag_id)
.group_by(DagRun.dag_id, DagRun.state, DagModel.dag_display_name)
.order_by(DagRun.dag_id)
)
This is not working since the unpacking approach doesn't work either because
MyPy sees list[object] instead of the individual types.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]