| 327 | ) |
| 328 | |
| 329 | def test_recursive_union_alias_two(self): |
| 330 | # I know, this is the PG VALUES keyword, |
| 331 | # we're cheating here. also yes we need the SELECT, |
| 332 | # sorry PG. |
| 333 | t = select(func.values(1).label("n")).cte("t", recursive=True) |
| 334 | t = t.union_all(select(t.c.n + 1).where(t.c.n < 100)).alias("ta") |
| 335 | s = select(func.sum(t.c.n)) |
| 336 | self.assert_compile( |
| 337 | s, |
| 338 | "WITH RECURSIVE t(n) AS " |
| 339 | "(SELECT values(:values_1) AS n " |
| 340 | "UNION ALL SELECT t.n + :n_1 AS anon_1 " |
| 341 | "FROM t " |
| 342 | "WHERE t.n < :n_2) " |
| 343 | "SELECT sum(ta.n) AS sum_1 FROM t AS ta", |
| 344 | ) |
| 345 | |
| 346 | def test_recursive_union_no_alias_three(self): |
| 347 | # like test one, but let's refer to the CTE |