]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fixup: try_cast: move visit_try_cast() to StrSQLCompiler
authorNick Crews <nicholas.b.crews@gmail.com>
Wed, 10 May 2023 16:13:45 +0000 (08:13 -0800)
committerNick Crews <nicholas.b.crews@gmail.com>
Wed, 10 May 2023 16:13:45 +0000 (08:13 -0800)
lib/sqlalchemy/sql/compiler.py

index 4299377044d0e8e1d38cfa0f9081c86684695ddb..b4e1352df2111296e0d34b4a4bf2819bcb57fe31 100644 (file)
@@ -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