| 1882 | ) |
| 1883 | |
| 1884 | def test_insert_uses_independent_cte(self): |
| 1885 | products = table("products", column("id"), column("price")) |
| 1886 | |
| 1887 | upd_cte = ( |
| 1888 | products.update().values(price=10).where(products.c.price > 50) |
| 1889 | ).cte() |
| 1890 | |
| 1891 | stmt = ( |
| 1892 | products.insert().values({"id": 1, "price": 20}).add_cte(upd_cte) |
| 1893 | ) |
| 1894 | |
| 1895 | self.assert_compile( |
| 1896 | stmt, |
| 1897 | "WITH anon_1 AS (UPDATE products SET price=:param_1 " |
| 1898 | "WHERE products.price > :price_1) " |
| 1899 | "INSERT INTO products (id, price) VALUES (:id, :price)", |
| 1900 | checkparams={"id": 1, "price": 20, "param_1": 10, "price_1": 50}, |
| 1901 | ) |
| 1902 | |
| 1903 | @testing.variation("num_ctes", ["one", "two"]) |
| 1904 | def test_multiple_multivalues_inserts(self, num_ctes): |