From 4652d4c7d3b73bfd5c03e78b6c8515f394042377 Mon Sep 17 00:00:00 2001 From: Pat Buxton Date: Wed, 11 Sep 2024 07:34:43 +0100 Subject: [PATCH] Check datetime_format before it is cast --- plaidcloud/utilities/sqlalchemy_functions.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plaidcloud/utilities/sqlalchemy_functions.py b/plaidcloud/utilities/sqlalchemy_functions.py index bea99ac..4a4672e 100644 --- a/plaidcloud/utilities/sqlalchemy_functions.py +++ b/plaidcloud/utilities/sqlalchemy_functions.py @@ -506,10 +506,9 @@ def compile_safe_to_timestamp_databend(element, compiler, **kw): text, datetime_format, *args = full_args text = func.cast(text, sqlalchemy.Text) - datetime_format = func.cast(datetime_format, sqlalchemy.Text) if datetime_format and '%' not in datetime_format: datetime_format = postgres_to_python_date_format(datetime_format) - + datetime_format = func.cast(datetime_format, sqlalchemy.Text) if args: compiled_args = ', '.join([compiler.process(arg) for arg in args]) return f"to_timestamp({compiler.process(text)}, {compiler.process(datetime_format)}, {compiled_args})"