You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Taragolis (via GitHub)" <gi...@apache.org> on 2023/08/24 07:45:01 UTC

[GitHub] [airflow] Taragolis commented on a diff in pull request #33672: Add limit 1 if required first value from query result

Taragolis commented on code in PR #33672:
URL: https://github.com/apache/airflow/pull/33672#discussion_r1303935419


##########
airflow/models/dagrun.py:
##########
@@ -1387,7 +1388,7 @@ def schedule_tis(
     @provide_session
     def get_log_template(self, *, session: Session = NEW_SESSION) -> LogTemplate:
         if self.log_template_id is None:  # DagRun created before LogTemplate introduction.
-            template = session.scalar(select(LogTemplate).order_by(LogTemplate.id))
+            template = session.scalar(select(LogTemplate).order_by(LogTemplate.id).limit(1))

Review Comment:
   Not really, the query for this condition is ```SELECT * FROM log ORDER BY log.id``` and result filtration happen on the client, nor DB backend.
   
   
   



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org