test that the ORDER BY is propagated from the inner select to the outer select, when using the 'wrapped' select statement resulting from the combination of eager loading and limit/offset clauses.
(self)
| 1476 | eq_(self.static.item_keyword_result[1:3], result) |
| 1477 | |
| 1478 | def test_limit_3(self): |
| 1479 | """test that the ORDER BY is propagated from the inner |
| 1480 | select to the outer select, when using the |
| 1481 | 'wrapped' select statement resulting from the combination of |
| 1482 | eager loading and limit/offset clauses.""" |
| 1483 | |
| 1484 | ( |
| 1485 | addresses, |
| 1486 | items, |
| 1487 | order_items, |
| 1488 | orders, |
| 1489 | Item, |
| 1490 | User, |
| 1491 | Address, |
| 1492 | Order, |
| 1493 | users, |
| 1494 | ) = ( |
| 1495 | self.tables.addresses, |
| 1496 | self.tables.items, |
| 1497 | self.tables.order_items, |
| 1498 | self.tables.orders, |
| 1499 | self.classes.Item, |
| 1500 | self.classes.User, |
| 1501 | self.classes.Address, |
| 1502 | self.classes.Order, |
| 1503 | self.tables.users, |
| 1504 | ) |
| 1505 | |
| 1506 | self.mapper_registry.map_imperatively(Item, items) |
| 1507 | self.mapper_registry.map_imperatively( |
| 1508 | Order, |
| 1509 | orders, |
| 1510 | properties=dict( |
| 1511 | items=relationship(Item, secondary=order_items, lazy="joined") |
| 1512 | ), |
| 1513 | ) |
| 1514 | |
| 1515 | self.mapper_registry.map_imperatively(Address, addresses) |
| 1516 | self.mapper_registry.map_imperatively( |
| 1517 | User, |
| 1518 | users, |
| 1519 | properties=dict( |
| 1520 | addresses=relationship( |
| 1521 | Address, lazy="joined", order_by=addresses.c.id |
| 1522 | ), |
| 1523 | orders=relationship( |
| 1524 | Order, lazy="joined", order_by=orders.c.id |
| 1525 | ), |
| 1526 | ), |
| 1527 | ) |
| 1528 | sess = fixture_session() |
| 1529 | |
| 1530 | q = sess.query(User) |
| 1531 | |
| 1532 | if not testing.against("mssql"): |
| 1533 | result = ( |
| 1534 | q.join(User.orders) |
| 1535 | .order_by(Order.user_id.desc()) |
nothing calls this directly
no test coverage detected