-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for ClickHouse dialect #193
Comments
Thanks for the report, @Shlomixg ! I had no idea ClickHouse was case sensitive. (Why would they do that to us?!) Should be easy enough to not lowercase the output, but... Are SQL keywords (like select) also case sensitive, or is it just some/all function names? I designed this with multiple dialects in mind, so it shouldn't be too bad to change the parsing logic to be case-sensitive. I'm just a little sad because we've gotten away with only one "polyglot" dialect so far. |
Thanks for your quick response! I think only the CH unique functions are case-sensitive, meaning that select isn't case-sensitive. |
Awesome, thank you for the extra info. That should make this pretty straightforward. We don't have to touch parsing and can still lowercase lots of tokens- we'll just leave identifiers (incl. function names) alone. CLI flag should be |
Implementation notes (this is bigger than I thought, to get the
|
@Shlomixg I'm cutting the release for 0.10.0 right now -- if you upgrade, you can run that version with |
Bravo :) |
Describe the bug
sqlfmt doesn't support the ClickHouse dialect which is case sensitive.
To Reproduce
input code:
SELECT toString(1) AS Test_string, toDateTime64('2022-05-25', 3) AS Test_dateTime64, ifNull(null, 'TestNull') as testIf, JSONExtractString('{"abc": "hello"}', 'abc') as testJSON
Expected behavior
select toString(1) as Test_string, toDateTime64('2022-05-25', 3) as Test_dateTime64, ifNull(null, 'TestNull') as testIf, JSONExtractString('{"abc": "hello"}', 'abc') as testJSON
Actual behavior
select tostring(1) as test_string, todatetime64('2022-05-25', 3) as test_datetime64, ifnull(NULL, 'TestNull') as testif, jsonextractstring('{"abc": "hello"}', 'abc') as testjson
this output is not a valid ClickHouse code
Additional context
What is the output of
sqlfmt --version
?sqlfmt, version 0.9.0
The text was updated successfully, but these errors were encountered: