ferruzzi commented on code in PR #70804:
URL: https://github.com/apache/airflow/pull/70804#discussion_r3693964889


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/deadlines.py:
##########
@@ -177,6 +177,7 @@ def get_dag_deadline_alerts(
         select(SerializedDagModel)
         .where(SerializedDagModel.dag_id == dag_id)
         .order_by(SerializedDagModel.id.desc())
+        .limit(1)

Review Comment:
   I think it looks safe and pretty sure that is code I actually wrote. 😅   I 
thought scalar() was enough, but you make a good point with the efficiency.
   
   I would add that I have since learned that we have 
`SerializedDagModel.get()` which might actually replace this whole query with 
(untested)
   
   ```python
   serialized_dag = SerializedDagModel.get(dag_id, session=session)
   ```
   
   If that works, you'd have to refactor some of the tests accordingly, but it 
might be a nice clean-up.  Feel free to ignore that though, it's a non-blocking 
suggestion.



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