From cae3b3122479d23becb382556844e52e450aed5a Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Tue, 4 Jun 2024 12:37:47 +0200 Subject: [PATCH] fix: 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 81de3801bff..32896d9a5a9 100644 --- a/src/DIRAC/AccountingSystem/DB/AccountingDB.py +++ b/src/DIRAC/AccountingSystem/DB/AccountingDB.py @@ -1062,7 +1062,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