)
return f"{clause} WITH ROLLUP"
+ def visit_string_agg_func(self, fn, **kw):
+ if len(fn.clauses) > 1:
+ return "group_concat(%s SEPARATOR %s)" % (
+ fn.clauses[0]._compiler_dispatch(self, **kw),
+ fn.clauses[-1]._compiler_dispatch(self, **kw),
+ )
+ else:
+ return "group_concat%s" % self.function_argspec(fn)
+
def visit_sequence(self, seq, **kw):
return "nextval(%s)" % self.preparer.format_sequence(seq)
self._is_implicitly_boolean = False
return self
+ def __getitem__(self, item) -> ColumnElement[Any]:
+ return self.clauses[item]
+
def __iter__(self) -> Iterator[ColumnElement[Any]]:
return iter(self.clauses)
literal_binds=True,
render_postcompile=True,
)
+ self.assert_compile(
+ stmt,
+ "SELECT group_concat(t.value SEPARATOR ',') "
+ "AS string_agg_1 FROM t",
+ dialect=mysql.dialect(),
+ literal_binds=True,
+ render_postcompile=True,
+ )
def test_cube_operators(self):
t = table(