jason810496 commented on code in PR #61483:
URL: https://github.com/apache/airflow/pull/61483#discussion_r2796590839


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dags.py:
##########
@@ -270,8 +297,7 @@ def get_latest_run_info(dag_id: str, session: SessionDep) 
-> DAGRunLightResponse
             status.HTTP_400_BAD_REQUEST,
             "`~` was supplied as dag_id, but querying multiple dags is not 
supported.",
         )
-
-    latest_run_info_select = (
+    return session.execute(

Review Comment:
   Could we add a comment explaining that we return the ORM object instead of a 
Pydantic data model for performance reasons, to prevent future PRs from 
changing the return type back to a Pydantic data model?



##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dags.py:
##########


Review Comment:
   ```bash
     airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dags.py:300: 
error: Incompatible return value type (got "Row[Any] | None", expected 
"DAGRunLightResponse | None")  [return-value]
             return session.execute(
   ```
   
   Mypy is not happy with the type annotation. It seems the only way is to 
workaround with `response_model`:
   
   ```suggestion
   def get_latest_run_info(dag_id: str, session: SessionDep, 
response_model=DAGRunLightResponse):
   ```



##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dags.py:
##########
@@ -190,7 +189,7 @@ def get_dags(
             DagRun.run_after,
             DagRun.start_date,
             DagRun.state,
-            DagRun.duration.expression,  # type: ignore[attr-defined]
+            DagRun.duration,

Review Comment:
   It seems we have to keep `DagRun.duration.expression,  # type: 
ignore[attr-defined]` for mypy.



-- 
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]

Reply via email to