diff --git a/frappe/query_builder/functions.py b/frappe/query_builder/functions.py index c1c7657b86..824de7fbf5 100644 --- a/frappe/query_builder/functions.py +++ b/frappe/query_builder/functions.py @@ -20,6 +20,14 @@ class Locate(Function): super().__init__("LOCATE", *terms, **kwargs) +class Timestamp(Function): + def __init__(self, term: str, time=None, alias=None): + if time: + super().__init__("TIMESTAMP", term, time, alias=alias) + else: + super().__init__("TIMESTAMP", term, alias=alias) + + GroupConcat = ImportMapper({db_type_is.MARIADB: GROUP_CONCAT, db_type_is.POSTGRES: STRING_AGG}) Match = ImportMapper({db_type_is.MARIADB: MATCH, db_type_is.POSTGRES: TO_TSVECTOR}) @@ -96,6 +104,7 @@ class SqlFunctions(Enum): Max = "max" Min = "min" Abs = "abs" + Timestamp = "timestamp" def _max(dt, fieldname, filters=None, **kwargs):