Skip to content

Commit

Permalink
Check datetime_format before it is cast
Browse files Browse the repository at this point in the history
  • Loading branch information
rad-pat committed Sep 11, 2024
1 parent ec327d2 commit 4652d4c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions plaidcloud/utilities/sqlalchemy_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})"
Expand Down

0 comments on commit 4652d4c

Please sign in to comment.