MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_outerjoin_where_x2_t1t3

Method test_outerjoin_where_x2_t1t3

test/sql/test_query.py:1591–1618  ·  view source on GitHub ↗

Outer joins t1->t2,t3, where on t1 and t3.

(self)

Source from the content-addressed store, hash-verified

1589 self.assertRows(expr, [(10, 20, 30)])
1590
1591 def test_outerjoin_where_x2_t1t3(self):
1592 """Outer joins t1->t2,t3, where on t1 and t3."""
1593
1594 t1, t2, t3 = self.tables("t1", "t2", "t3")
1595
1596 for criteria in (t2.c.t2_id == t3.c.t2_id, t3.c.t2_id == t2.c.t2_id):
1597 expr = (
1598 select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id)
1599 .where(and_(t1.c.name == "t1 #10", t3.c.name == "t3 #30"))
1600 .select_from(
1601 t1.outerjoin(t2, t1.c.t1_id == t2.c.t1_id).outerjoin(
1602 t3, criteria
1603 )
1604 )
1605 )
1606
1607 self.assertRows(expr, [(10, 20, 30)])
1608
1609 expr = (
1610 select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id)
1611 .where(and_(t1.c.t1_id < 19, t3.c.t3_id < 39))
1612 .select_from(
1613 t1.outerjoin(t2, t1.c.t1_id == t2.c.t1_id).outerjoin(
1614 t3, criteria
1615 )
1616 )
1617 )
1618 self.assertRows(expr, [(10, 20, 30)])
1619
1620 def test_outerjoin_where_x2_t1t2(self):
1621 """Outer joins t1->t2,t3, where on t1 and t2."""

Callers

nothing calls this directly

Calls 6

assertRowsMethod · 0.95
selectFunction · 0.90
and_Function · 0.90
select_fromMethod · 0.45
whereMethod · 0.45
outerjoinMethod · 0.45

Tested by

no test coverage detected