Skip to content
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

Feature Request: ClickHouse dialect #614

Open
derN3rd opened this issue Jun 22, 2023 · 1 comment
Open

Feature Request: ClickHouse dialect #614

derN3rd opened this issue Jun 22, 2023 · 1 comment

Comments

@derN3rd
Copy link

derN3rd commented Jun 22, 2023

Describe the Feature

Hey there,
I'm currently very happy with sql-formatter in my code base, but I've just started to use ClickHouse for an analytics project and figured out that the formatting is breaking the SQL files (resulting in invalid queries).

Don't exactly know if one of the existing languages is similar to ClickHouse, but it seems not, as they have added a few custom keywords.

Their SQL reference is here: https://clickhouse.com/docs/en/sql-reference

Thanks in advance

Why do you want this feature?
Dialect of ClickHouse seems to be different from already provided languages

@nene
Copy link
Collaborator

nene commented Jun 24, 2023

Thanks for the feature request.

From my first glance it indeed doesn't look very similar to any other SQL dialect I know of. Notably it has the $foo$heredoc$foo$ strings like Postgres, while supporting both "double quotes" and `backticks` for quoting identifiers like SQLite.

If you're interested in getting a support for it, you unfortunately need to put in some effort to make it happen. I'm open for a pull request, but I'm not really interested in implementing it by myself. Luckily for you, adding a support for a new dialect to sql-formatter is not that hard. You don't even need to fork sql-formatter to do so, you can just provide it a custom dialect definition.

Well, admittedly there's not that much of documentation there, but just copying an existing dialect implementation from sql-formatter source code and modifying it slightly should be pretty simple.

You can also look at the wiki, which documents syntax details of all the currently supported SQL dialects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants