From adfcf6913a0cae5357fb6b44671cbbc542eda5b5 Mon Sep 17 00:00:00 2001 From: Erling Mathias Staff Date: Mon, 29 Jul 2024 19:16:49 +0200 Subject: [PATCH] Core & Internals: Fixes replica.py sqla20 regression #6983 --- lib/rucio/core/replica.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/rucio/core/replica.py b/lib/rucio/core/replica.py index e7ed9a61e8..2426b27cb4 100644 --- a/lib/rucio/core/replica.py +++ b/lib/rucio/core/replica.py @@ -4046,21 +4046,16 @@ def get_suspicious_reason(rse_id, scope, name, nattempts=0, logger=logging.log, bad_replicas_alias.name == name, bad_replicas_alias.scope == scope, bad_replicas_alias.state != 'S')))) - ).subquery() + ) count_query = select( func.count() ).select_from( - stmt + stmt.subquery() ) count = session.execute(count_query).scalar_one() - grouped_stmt = select( - bad_replicas_alias.scope, - bad_replicas_alias.name, - bad_replicas_alias.reason, - bad_replicas_alias.rse_id - ).group_by( + grouped_stmt = stmt.group_by( bad_replicas_alias.rse_id, bad_replicas_alias.scope, bad_replicas_alias.name,