]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Modify implementation of mysql `string_agg` to avoid discarding arguments
authorJoshua Morris <joshuajohnmorris@gmail.com>
Sun, 4 Jun 2023 10:52:32 +0000 (20:52 +1000)
committerJoshua Morris <joshua.morris@deswik.com>
Mon, 10 Jul 2023 22:48:07 +0000 (08:48 +1000)
lib/sqlalchemy/dialects/mysql/base.py

index 4712c9b40226c2cfab04a89e07cfff20ba2f88ab..8c77f1c585ac9fa5d0f4213e60971db6bf7d09b0 100644 (file)
@@ -1210,8 +1210,11 @@ class MySQLCompiler(compiler.SQLCompiler):
 
     def visit_string_agg_func(self, fn, **kw):
         if len(fn.clauses) > 1:
+            clause = ", ".join(
+                elem._compiler_dispatch(self, **kw) for elem in fn.clauses[:-1]
+            )
             return "group_concat(%s SEPARATOR %s)" % (
-                fn.clauses[0]._compiler_dispatch(self, **kw),
+                clause,
                 fn.clauses[-1]._compiler_dispatch(self, **kw),
             )
         else: