test :ticket:`6259`
(self, query_expression_w_joinedload_fixture)
| 1628 | ) |
| 1629 | |
| 1630 | def test_with_expr_four(self, query_expression_w_joinedload_fixture): |
| 1631 | """test :ticket:`6259`""" |
| 1632 | User = query_expression_w_joinedload_fixture |
| 1633 | |
| 1634 | stmt = ( |
| 1635 | select(User) |
| 1636 | .options( |
| 1637 | with_expression(User.value, null()), joinedload(User.addresses) |
| 1638 | ) |
| 1639 | .limit(1) |
| 1640 | ) |
| 1641 | |
| 1642 | # test that the outer IS NULL is rendered, not adapted |
| 1643 | # test that the inner query includes the NULL we asked for |
| 1644 | |
| 1645 | # ironically, this statement would not actually fetch due to the NULL |
| 1646 | # not allowing adaption and therefore failing on the result set |
| 1647 | # matching, this was addressed in #7154. |
| 1648 | self.assert_compile( |
| 1649 | stmt, |
| 1650 | "SELECT anon_2.anon_1, anon_2.id, anon_2.name, " |
| 1651 | "addresses_1.id AS id_1, addresses_1.user_id, " |
| 1652 | "addresses_1.email_address FROM (SELECT NULL AS anon_1, " |
| 1653 | "users.id AS id, users.name AS name FROM users LIMIT :param_1) " |
| 1654 | "AS anon_2 LEFT OUTER JOIN addresses AS addresses_1 " |
| 1655 | "ON addresses_1.user_id = anon_2.id " |
| 1656 | "AND addresses_1.email_address IS NOT NULL", |
| 1657 | ) |
| 1658 | |
| 1659 | def test_joinedload_outermost(self, plain_fixture): |
| 1660 | User, Address = plain_fixture |
nothing calls this directly
no test coverage detected