test #12364
(self, annotated)
| 541 | |
| 542 | @testing.variation("annotated", [True, False]) |
| 543 | def test_cte_w_annotated(self, annotated): |
| 544 | """test #12364""" |
| 545 | |
| 546 | A = table("a", column("i"), column("j")) |
| 547 | B = table("b", column("i"), column("j")) |
| 548 | |
| 549 | a = select(A).where(A.c.i > A.c.j).cte("filtered_a") |
| 550 | |
| 551 | if annotated: |
| 552 | a = a._annotate({"foo": "bar"}) |
| 553 | |
| 554 | a1 = select(a.c.i, literal(1).label("j")) |
| 555 | b = select(B).join(a, a.c.i == B.c.i).where(B.c.j.is_not(None)) |
| 556 | |
| 557 | query = union_all(a1, b) |
| 558 | self.assert_compile( |
| 559 | query, |
| 560 | "WITH filtered_a AS " |
| 561 | "(SELECT a.i AS i, a.j AS j FROM a WHERE a.i > a.j) " |
| 562 | "SELECT filtered_a.i, :param_1 AS j FROM filtered_a " |
| 563 | "UNION ALL SELECT b.i, b.j " |
| 564 | "FROM b JOIN filtered_a ON filtered_a.i = b.i " |
| 565 | "WHERE b.j IS NOT NULL", |
| 566 | ) |
| 567 | |
| 568 | def test_with_recursive_no_name_currently_buggy(self): |
| 569 | s1 = select(1) |
nothing calls this directly
no test coverage detected