Prab-27 commented on code in PR #59918:
URL: https://github.com/apache/airflow/pull/59918#discussion_r2667880573
##########
airflow-core/src/airflow/utils/db_cleanup.py:
##########
@@ -223,8 +224,10 @@ def _do_delete(
batch_counter = itertools.count(1)
while True:
- limited_query = query.limit(batch_size) if batch_size else query
- if limited_query.count() == 0: # nothing left to delete
+ limited_statement = statement.limit(batch_size) if batch_size else
statement
+ if (
+
session.execute(select(func.count()).select_from(limited_statement.subquery())).scalar()
or 0
+ ) == 0:
Review Comment:
What if we directly use (session.scalar() or 0) ?
Could you please share your thoughts on this ?
--
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]