MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_outerjoin_where_x2_t1

Method test_outerjoin_where_x2_t1

test/sql/test_query.py:1510–1535  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

1508 )
1509
1510 def test_outerjoin_where_x2_t1(self):
1511 """Outer joins t1->t2,t3, where on t1."""
1512 t1, t2, t3 = self.tables("t1", "t2", "t3")
1513
1514 for criteria in (t2.c.t2_id == t3.c.t2_id, t3.c.t2_id == t2.c.t2_id):
1515 expr = (
1516 select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id)
1517 .where(t1.c.name == "t1 #10")
1518 .select_from(
1519 t1.outerjoin(t2, t1.c.t1_id == t2.c.t1_id).outerjoin(
1520 t3, criteria
1521 )
1522 )
1523 )
1524 self.assertRows(expr, [(10, 20, 30)])
1525
1526 expr = (
1527 select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id)
1528 .where(t1.c.t1_id < 12)
1529 .select_from(
1530 t1.outerjoin(t2, t1.c.t1_id == t2.c.t1_id).outerjoin(
1531 t3, criteria
1532 )
1533 )
1534 )
1535 self.assertRows(expr, [(10, 20, 30), (11, 21, None)])
1536
1537 def test_outerjoin_where_x2_t2(self):
1538 """Outer joins t1->t2,t3, where on t2."""

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected