MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_custom_group_by_clause

Method test_custom_group_by_clause

test/sql/test_compiler.py:2202–2217  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2200 )
2201
2202 def test_custom_group_by_clause(self):
2203 class CustomCompiler(PGCompiler):
2204 def group_by_clause(self, select, **kw):
2205 return super().group_by_clause(select, **kw) + " CUSTOMIZED"
2206
2207 class CustomDialect(PGDialect):
2208 name = "custom"
2209 statement_compiler = CustomCompiler
2210
2211 stmt = select(table1.c.myid).group_by(table1.c.myid)
2212 self.assert_compile(
2213 stmt,
2214 "SELECT mytable.myid FROM mytable GROUP BY "
2215 "mytable.myid CUSTOMIZED",
2216 dialect=CustomDialect(),
2217 )
2218
2219 def test_for_update(self):
2220 self.assert_compile(

Callers

nothing calls this directly

Calls 4

selectFunction · 0.90
CustomDialectClass · 0.85
assert_compileMethod · 0.80
group_byMethod · 0.45

Tested by

no test coverage detected