This is an automated email from the ASF dual-hosted git repository.

potiuk 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 536c9fb1f2 `synchronize_log_template`: limit query result on DB rather 
than client (#35366)
536c9fb1f2 is described below

commit 536c9fb1f20951da8a61a74df11a35655b1087ec
Author: Andrey Anshin <andrey.ans...@taragol.is>
AuthorDate: Thu Nov 2 19:37:05 2023 +0400

    `synchronize_log_template`: limit query result on DB rather than client 
(#35366)
---
 airflow/utils/db.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/airflow/utils/db.py b/airflow/utils/db.py
index b87edce827..39f3442997 100644
--- a/airflow/utils/db.py
+++ b/airflow/utils/db.py
@@ -911,7 +911,9 @@ def synchronize_log_template(*, session: Session = 
NEW_SESSION) -> None:
         select(
             log_template_table.c.filename,
             log_template_table.c.elasticsearch_id,
-        ).order_by(log_template_table.c.id.desc()),
+        )
+        .order_by(log_template_table.c.id.desc())
+        .limit(1)
     ).first()
 
     # If we have an empty table, and the default values exist, we will seed the
@@ -946,6 +948,7 @@ def synchronize_log_template(*, session: Session = 
NEW_SESSION) -> None:
                 )
             )
             .order_by(log_template_table.c.id.desc())
+            .limit(1)
         ).first()
         if not row:
             session.add(

Reply via email to