Snowflake Integer Placeholder Replacement #3163
-
In the case of a query like:
I'd like to be able to replace the Thank you for any insight! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @brentonmallen1, I assume you meant that it's not possible to pass these kwargs by doing >>> import sqlglot
>>>
>>> sql = """
... select
... col1, col2, col3, col4, sum(col5) as sum_col5
... from table_name
... where col_name IN (:10,:11)
... group by 1,2,3,4
... """
>>>
>>> sqlglot.exp.replace_placeholders(sqlglot.parse_one(sql), **{"10": "foo", "11": "bar"}).sql()
"SELECT col1, col2, col3, col4, SUM(col5) AS sum_col5 FROM table_name WHERE col_name IN ('foo', 'bar') GROUP BY 1, 2, 3, 4" |
Beta Was this translation helpful? Give feedback.
Hey @brentonmallen1,
I assume you meant that it's not possible to pass these kwargs by doing
replace_placeholders(expr, 10=..., 11=...)
. To work around this limitation you can just expand a dictionary in Python, like so: