Joins t1->t2, outer t2->t3, plus a where on each table in turn.
(self)
| 1690 | self.assertRows(expr, [(10, 20, 30), (11, 21, None)]) |
| 1691 | |
| 1692 | def test_mixed_where(self): |
| 1693 | """Joins t1->t2, outer t2->t3, plus a where on each table in turn.""" |
| 1694 | t1, t2, t3 = self.tables("t1", "t2", "t3") |
| 1695 | |
| 1696 | for criteria in (t2.c.t2_id == t3.c.t2_id, t3.c.t2_id == t2.c.t2_id): |
| 1697 | expr = ( |
| 1698 | select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id) |
| 1699 | .where( |
| 1700 | t1.c.name == "t1 #10", |
| 1701 | ) |
| 1702 | .select_from(t1.join(t2).outerjoin(t3, criteria)) |
| 1703 | ) |
| 1704 | self.assertRows(expr, [(10, 20, 30)]) |
| 1705 | |
| 1706 | expr = ( |
| 1707 | select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id) |
| 1708 | .where( |
| 1709 | t2.c.name == "t2 #20", |
| 1710 | ) |
| 1711 | .select_from(t1.join(t2).outerjoin(t3, criteria)) |
| 1712 | ) |
| 1713 | self.assertRows(expr, [(10, 20, 30)]) |
| 1714 | |
| 1715 | expr = ( |
| 1716 | select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id) |
| 1717 | .where( |
| 1718 | t3.c.name == "t3 #30", |
| 1719 | ) |
| 1720 | .select_from(t1.join(t2).outerjoin(t3, criteria)) |
| 1721 | ) |
| 1722 | self.assertRows(expr, [(10, 20, 30)]) |
| 1723 | |
| 1724 | expr = ( |
| 1725 | select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id) |
| 1726 | .where( |
| 1727 | and_(t1.c.name == "t1 #10", t2.c.name == "t2 #20"), |
| 1728 | ) |
| 1729 | .select_from(t1.join(t2).outerjoin(t3, criteria)) |
| 1730 | ) |
| 1731 | self.assertRows(expr, [(10, 20, 30)]) |
| 1732 | |
| 1733 | expr = ( |
| 1734 | select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id) |
| 1735 | .where( |
| 1736 | and_(t2.c.name == "t2 #20", t3.c.name == "t3 #30"), |
| 1737 | ) |
| 1738 | .select_from(t1.join(t2).outerjoin(t3, criteria)) |
| 1739 | ) |
| 1740 | self.assertRows(expr, [(10, 20, 30)]) |
| 1741 | |
| 1742 | expr = ( |
| 1743 | select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id) |
| 1744 | .where( |
| 1745 | and_( |
| 1746 | t1.c.name == "t1 #10", |
| 1747 | t2.c.name == "t2 #20", |
| 1748 | t3.c.name == "t3 #30", |
| 1749 | ), |
nothing calls this directly
no test coverage detected