MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_correlate_except_froms

Method test_correlate_except_froms

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

Source from the content-addressed store, hash-verified

7729 )
7730
7731 def test_correlate_except_froms(self):
7732 # new as of #2748
7733 t1 = table("t1", column("a"))
7734 t2 = table("t2", column("a"), column("b"))
7735 s = select(t2.c.b).where(t1.c.a == t2.c.a)
7736 s = s.correlate_except(t2).alias("s")
7737
7738 s2 = select(func.foo(s.c.b)).scalar_subquery()
7739 s3 = select(t1).order_by(s2)
7740
7741 self.assert_compile(
7742 s3,
7743 "SELECT t1.a FROM t1 ORDER BY "
7744 "(SELECT foo(s.b) AS foo_1 FROM "
7745 "(SELECT t2.b AS b FROM t2 WHERE t1.a = t2.a) AS s)",
7746 )
7747
7748 def test_multilevel_froms_correlation(self):
7749 # new as of #2748

Callers

nothing calls this directly

Calls 10

tableFunction · 0.90
columnFunction · 0.90
selectFunction · 0.90
assert_compileMethod · 0.80
whereMethod · 0.45
aliasMethod · 0.45
correlate_exceptMethod · 0.45
scalar_subqueryMethod · 0.45
fooMethod · 0.45
order_byMethod · 0.45

Tested by

no test coverage detected