From 922601b74ca571f86a507263f42d1f37ce70783a Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Tue, 4 Jun 2024 15:13:18 +0200 Subject: [PATCH] sweep: #7637 AccountingDB: only generate condition if needed --- src/DIRAC/AccountingSystem/DB/AccountingDB.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DIRAC/AccountingSystem/DB/AccountingDB.py b/src/DIRAC/AccountingSystem/DB/AccountingDB.py index 0ea66f19b57..e66686ce00a 100644 --- a/src/DIRAC/AccountingSystem/DB/AccountingDB.py +++ b/src/DIRAC/AccountingSystem/DB/AccountingDB.py @@ -1030,7 +1030,8 @@ def __queryType( sqlORList.append(f"`{_getTableName('key', typeName, keyName)}`.`value` = {keyValue}") else: sqlORList.append(f"`{tableName}`.`{keyName}` = {keyValue}") - sqlCondList.append(f"( {' OR '.join(sqlORList)} )") + if sqlORList: + sqlCondList.append(f"( {' OR '.join(sqlORList)} )") if sqlCondList: cmd += f" AND {' AND '.join(sqlCondList)}" # Calculate grouping and sorting