MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_prefixes

Method test_prefixes

test/sql/test_cte.py:1197–1217  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1195 )
1196
1197 def test_prefixes(self):
1198 orders = table("order", column("order"))
1199 s = select(orders.c.order).cte("regional_sales")
1200 s = s.prefix_with("NOT MATERIALIZED", dialect="postgresql")
1201 stmt = select(orders).where(orders.c.order > s.c.order)
1202
1203 self.assert_compile(
1204 stmt,
1205 'WITH regional_sales AS (SELECT "order"."order" AS "order" '
1206 'FROM "order") SELECT "order"."order" FROM "order", '
1207 'regional_sales WHERE "order"."order" > regional_sales."order"',
1208 )
1209
1210 self.assert_compile(
1211 stmt,
1212 "WITH regional_sales AS NOT MATERIALIZED "
1213 '(SELECT "order"."order" AS "order" '
1214 'FROM "order") SELECT "order"."order" FROM "order", '
1215 'regional_sales WHERE "order"."order" > regional_sales."order"',
1216 dialect="postgresql",
1217 )
1218
1219 def test_suffixes(self):
1220 orders = table("order", column("order"))

Callers

nothing calls this directly

Calls 7

tableFunction · 0.90
columnFunction · 0.90
selectFunction · 0.90
prefix_withMethod · 0.80
assert_compileMethod · 0.80
cteMethod · 0.45
whereMethod · 0.45

Tested by

no test coverage detected