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