apache / datafusion-sqlparser-rs

Extensible SQL Lexer and Parser for Rust
Apache License 2.0
2.76k stars 527 forks source link

ClickHouse parameterized view #1167

Open flipchart opened 7 months ago

flipchart commented 7 months ago

I'd like to parse ClickHouse SQL which contains parameters for their parameterized views. The SQL looks like

CREATE VIEW view AS SELECT * FROM TABLE WHERE Column1={column1:datatype1}

Note the parameter is in the { } brackets. I don't think this could be implemented in the Dialect as curly braces are tokenized without deferring to the dialect. It would probably have to be handled by the tokenizer as a special case like numbers are for MySQL & Hive.

alamb commented 7 months ago

Makes sense to me 👍