Skip to content

Feature Request: ClickHouse dialect #614

Closed

Description

@derN3rd

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

Activity

  1. nene commented on Jun 24, 2023

    @nene
    Collaborator

    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.

  2. garysassano commented on Jul 25, 2025

    @garysassano

    Any update on this?

  3. nene commented on Aug 15, 2025

    @nene
    Collaborator

    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.

  4. added a commit that references this issue on Jan 14, 2026
  5. nene commented on Jan 14, 2026

    @nene
    Collaborator

    Clickhouse support is now available in 15.7.0

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions