From: Nick Crews Date: Wed, 10 May 2023 16:13:45 +0000 (-0800) Subject: fixup: try_cast: move visit_try_cast() to StrSQLCompiler X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16f1ab1c306c5d46da9a7c816f700237b0a8696d;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git fixup: try_cast: move visit_try_cast() to StrSQLCompiler --- diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 4299377044..b4e1352df2 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -2777,12 +2777,6 @@ class SQLCompiler(Compiled): cast.typeclause._compiler_dispatch(self, **kwargs), ) - def visit_try_cast(self, cast, **kwargs): - return "TRY_CAST(%s AS %s)" % ( - cast.clause._compiler_dispatch(self, **kwargs), - cast.typeclause._compiler_dispatch(self, **kwargs), - ) - def _format_frame_clause(self, range_, **kw): return "%s AND %s" % ( @@ -6350,6 +6344,12 @@ class StrSQLCompiler(SQLCompiler): replacement._compiler_dispatch(self, **kw), ) + def visit_try_cast(self, cast, **kwargs): + return "TRY_CAST(%s AS %s)" % ( + cast.clause._compiler_dispatch(self, **kwargs), + cast.typeclause._compiler_dispatch(self, **kwargs), + ) + class DDLCompiler(Compiled): is_ddl = True