MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_custom_order_by_clause

Method test_custom_order_by_clause

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

Source from the content-addressed store, hash-verified

2183 )
2184
2185 def test_custom_order_by_clause(self):
2186 class CustomCompiler(PGCompiler):
2187 def order_by_clause(self, select, **kw):
2188 return super().order_by_clause(select, **kw) + " CUSTOMIZED"
2189
2190 class CustomDialect(PGDialect):
2191 name = "custom"
2192 statement_compiler = CustomCompiler
2193
2194 stmt = select(table1.c.myid).order_by(table1.c.myid)
2195 self.assert_compile(
2196 stmt,
2197 "SELECT mytable.myid FROM mytable ORDER BY "
2198 "mytable.myid CUSTOMIZED",
2199 dialect=CustomDialect(),
2200 )
2201
2202 def test_custom_group_by_clause(self):
2203 class CustomCompiler(PGCompiler):

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected