- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2025 02:27 AM - edited 10-26-2025 02:30 AM
I'm looking for a SQL formatter (CLI) for two different contexts within Databricks.
1. SQL queries in .sql files - What tool does Databricks use by default to format SQL?
2. %sql magic cells in notebooks (.ipynb files) - What tool does Databricks use by default to format SQL in %sql cells?
Databricks currently appears to use gethue/sql-formatter for both contexts, but I have some concerns with this tool:
- The project hasn't been updated in four years.
- It doesn't properly support %sql cells in .ipynb notebooks. I'm sure there are custom customizations, especially for #2.
- I don't want to rely on an unmaintained tool.
What I'm looking for:
I'm looking for an alternative tool that meets the following criteria:
- Officially provided by Databricks or Databricks Labs
- Supports both .sql files and %sql cells in .ipynb
- Available as a CLI command or installable package (e.g., for CI/CD pipelines)
Does Databricks or Databricks Labs provide such a tool? If not, are there any officially recommended commands or packages that meet these requirements?
I'd appreciate any guidance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2025 07:57 AM - edited 10-26-2025 08:01 AM
Hi @Lenoq ,
As far as I know, currently there is no tool that meets your given criteria by databricks/labs. The closest that I can see is the tool you gave as an example, but as you said its not that good. what I would do maybe is an intermedial option with sqlfluff that would format the sql queries, however, it would need some extra handling to strip or ignore %sql magic lines when used on notebook content.
Best, Ilir