| 204 | ) |
| 205 | |
| 206 | def test_values_in_select_cte_params(self): |
| 207 | cte1 = select( |
| 208 | values( |
| 209 | column("col1", String), |
| 210 | column("col2", Integer), |
| 211 | name="temp_table", |
| 212 | ).data([("a", 2), ("b", 3)]) |
| 213 | ).cte("cte1") |
| 214 | |
| 215 | cte2 = select(cte1.c.col1).where(cte1.c.col1 == "q").cte("cte2") |
| 216 | stmt = select(cte2.c.col1) |
| 217 | |
| 218 | dialect = default.DefaultDialect() |
| 219 | dialect.positional = True |
| 220 | dialect.paramstyle = "numeric" |
| 221 | self.assert_compile( |
| 222 | stmt, |
| 223 | "WITH cte1 AS (SELECT temp_table.col1 AS col1, " |
| 224 | "temp_table.col2 AS col2 FROM (VALUES (:1, :2), (:3, :4)) AS " |
| 225 | "temp_table (col1, col2)), " |
| 226 | "cte2 AS " |
| 227 | "(SELECT cte1.col1 AS col1 FROM cte1 WHERE cte1.col1 = :5) " |
| 228 | "SELECT cte2.col1 FROM cte2", |
| 229 | checkpositional=("a", 2, "b", 3, "q"), |
| 230 | dialect=dialect, |
| 231 | ) |
| 232 | |
| 233 | self.assert_compile( |
| 234 | stmt, |
| 235 | "WITH cte1 AS (SELECT temp_table.col1 AS col1, " |
| 236 | "temp_table.col2 AS col2 FROM (VALUES ('a', 2), ('b', 3)) " |
| 237 | "AS temp_table (col1, col2)), " |
| 238 | "cte2 AS " |
| 239 | "(SELECT cte1.col1 AS col1 FROM cte1 WHERE cte1.col1 = 'q') " |
| 240 | "SELECT cte2.col1 FROM cte2", |
| 241 | literal_binds=True, |
| 242 | dialect=dialect, |
| 243 | ) |
| 244 | |
| 245 | def test_values_in_select_cte_literal_binds(self): |
| 246 | cte1 = select( |