(self)
| 1446 | ) |
| 1447 | |
| 1448 | def test_orderby_subquery(self): |
| 1449 | self.assert_compile( |
| 1450 | table1.select().order_by( |
| 1451 | select(table2.c.otherid) |
| 1452 | .where(table1.c.myid == table2.c.otherid) |
| 1453 | .scalar_subquery() |
| 1454 | ), |
| 1455 | "SELECT mytable.myid, mytable.name, " |
| 1456 | "mytable.description FROM mytable ORDER BY " |
| 1457 | "(SELECT myothertable.otherid FROM " |
| 1458 | "myothertable WHERE mytable.myid = " |
| 1459 | "myothertable.otherid)", |
| 1460 | ) |
| 1461 | self.assert_compile( |
| 1462 | table1.select().order_by( |
| 1463 | desc( |
| 1464 | select(table2.c.otherid) |
| 1465 | .where(table1.c.myid == table2.c.otherid) |
| 1466 | .scalar_subquery() |
| 1467 | ) |
| 1468 | ), |
| 1469 | "SELECT mytable.myid, mytable.name, " |
| 1470 | "mytable.description FROM mytable ORDER BY " |
| 1471 | "(SELECT myothertable.otherid FROM " |
| 1472 | "myothertable WHERE mytable.myid = " |
| 1473 | "myothertable.otherid) DESC", |
| 1474 | ) |
| 1475 | |
| 1476 | def test_scalar_select(self): |
| 1477 | s = select(table1.c.myid).correlate(None).scalar_subquery() |
nothing calls this directly
no test coverage detected