diff --git a/src/DIRAC/Core/Utilities/MySQL.py b/src/DIRAC/Core/Utilities/MySQL.py index 01cf901e500..210ff763098 100755 --- a/src/DIRAC/Core/Utilities/MySQL.py +++ b/src/DIRAC/Core/Utilities/MySQL.py @@ -180,7 +180,7 @@ def _checkFields(inFields, inValues): return S_OK() -def _quotedList(fieldList=None): +def _quotedList(fieldList=None, allowDate=False): """ Quote a list of MySQL Field Names with "`" Return a comma separated list of quoted Field Names @@ -192,7 +192,11 @@ def _quotedList(fieldList=None): quotedFields = [] try: for field in fieldList: - quotedFields.append(f"`{field.replace('`', '')}`") + if allowDate and field.startswith("date(") and field.endswith(")"): + field = field[len("date(") : -len(")")] + quotedFields.append(f"date(`{field.replace('`', '')}`)") + else: + quotedFields.append(f"`{field.replace('`', '')}`") except Exception: return None if not quotedFields: @@ -1115,7 +1119,7 @@ def getCounters( # self.log.debug('getCounters:', error) return S_ERROR(DErrno.EMYSQL, error) - attrNames = _quotedList(attrList) + attrNames = _quotedList(attrList, allowDate=True) if attrNames is None: error = "Invalid updateFields argument" # self.log.debug('getCounters:', error) diff --git a/src/DIRAC/TransformationSystem/DB/TransformationDB.py b/src/DIRAC/TransformationSystem/DB/TransformationDB.py index 37ec1b752cd..174188b5b28 100755 --- a/src/DIRAC/TransformationSystem/DB/TransformationDB.py +++ b/src/DIRAC/TransformationSystem/DB/TransformationDB.py @@ -727,7 +727,7 @@ def getTransformationFilesCount(self, transName, field, selection=None, connecti connection = res["Value"]["Connection"] transID = res["Value"]["TransformationID"] selection["TransformationID"] = transID - if field not in self.TRANSFILEPARAMS: + if field not in self.TRANSFILEPARAMS + ["date(LastUpdate)", "date(InsertedTime)"]: return S_ERROR("Supplied field not in TransformationFiles table") res = self.getCounters("TransformationFiles", ["TransformationID", field], selection) if not res["OK"]: