test #7798 , regression from #7760
(self)
| 1861 | ) |
| 1862 | |
| 1863 | def test_textual_select_stack_correction(self): |
| 1864 | """test #7798 , regression from #7760""" |
| 1865 | |
| 1866 | foo = table("foo", column("id")) |
| 1867 | bar = table("bar", column("id"), column("attr"), column("foo_id")) |
| 1868 | |
| 1869 | s1 = text("SELECT id FROM foo").columns(foo.c.id) |
| 1870 | s2 = text( |
| 1871 | "SELECT bar.id, bar.attr FROM bar WHERE br.id IN " |
| 1872 | "(SELECT id FROM baz)" |
| 1873 | ).columns(bar.c.id, bar.c.attr) |
| 1874 | s3 = bar.insert().from_select(list(s2.selected_columns), s2) |
| 1875 | s4 = s3.add_cte(s1.cte(name="baz")) |
| 1876 | |
| 1877 | self.assert_compile( |
| 1878 | s4, |
| 1879 | "WITH baz AS (SELECT id FROM foo) INSERT INTO bar (id, attr) " |
| 1880 | "SELECT bar.id, bar.attr FROM bar WHERE br.id IN " |
| 1881 | "(SELECT id FROM baz)", |
| 1882 | ) |
| 1883 | |
| 1884 | def test_insert_uses_independent_cte(self): |
| 1885 | products = table("products", column("id"), column("price")) |
nothing calls this directly
no test coverage detected