From 16f1ab1c306c5d46da9a7c816f700237b0a8696d Mon Sep 17 00:00:00 2001 From: Nick Crews Date: Wed, 10 May 2023 08:13:45 -0800 Subject: [PATCH] fixup: try_cast: move visit_try_cast() to StrSQLCompiler --- lib/sqlalchemy/sql/compiler.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 -- 2.47.3