You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Why do you want this feature?
Dialect of ClickHouse seems to be different from already provided languages
Reacted by Lahiru, Sundar, Tomasz Czubocha, Valerii Sorokobatko, Anthony Pessy, Olexandr Sydorchuk, ruslan-savina, Li Zhao, Pavel Kravtsov, Karl-Aksel Puulmann and 8 more
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.
I'm personally not going to implement any new dialects. Submit a pull request if you're interested. The implementation part is not really hard, the hard part is reading all the documentation and figuring out all the details about the syntax of the dialect.
Activity
nene commentedon 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.
garysassano commentedon Jul 25, 2025
Any update on this?
nene commentedon Aug 15, 2025
I'm personally not going to implement any new dialects. Submit a pull request if you're interested. The implementation part is not really hard, the hard part is reading all the documentation and figuring out all the details about the syntax of the dialect.
Add Clickhouse formatter (#922)
nene commentedon Jan 14, 2026
Clickhouse support is now available in 15.7.0