A compact SQL formatter with dialect-aware parsing.
Project description
sql-neatfmt
sql-neatfmt is a compact SQL formatter designed for editor use.
It uses SQLGlot for dialect-aware parsing and owns the final layout rules.
The formatter intentionally favors readable query editing:
SELECT a.id,
a.name,
b.code code_name
FROM table_a a
LEFT JOIN table_b b
ON a.id = b.a_id
AND b.deleted = 0
WHERE a.status = 1
AND a.created_at >= DATE '2026-04-01'
GROUP BY a.id
ORDER BY a.id DESC;
Usage
sql-neatfmt --dialect mysql < query.sql
sql-neatfmt --dialect postgres query.sql
sql-neatfmt --dialect oracle --fix query.sql
sql-neatfmt --dialect mysql --keyword-case lower query.sql
Keywords are uppercased by default. Use --keyword-case lower or
--no-uppercase-keywords to emit lowercase keywords instead.
Installation
Install from a local checkout:
uv tool install --from ~/repos/sql-neatfmt sql-neatfmt
Install from a Git checkout:
uv tool install git+https://github.com/LuciusChen/sql-neatfmt
After publishing to PyPI:
uv tool install sql-neatfmt
Build release artifacts:
uv build --no-sources
Publish to PyPI from GitHub Actions:
- Create a PyPI pending trusted publisher for
sql-neatfmt. - Use owner
LuciusChen, repositorysql-neatfmt, workflowpublish.yml, and environmentpypi. - Run the
Publishworkflow from GitHub Actions, or publish a GitHub release.
Publish from this checkout after setting a PyPI token:
uv publish --check-url https://pypi.org/simple/
Supported initial dialect names follow SQLGlot: mysql, postgres, oracle,
sqlite, tsql, and others accepted by SQLGlot.
Scope
This is intentionally conservative. Parse failures, comments, and templated SQL are returned unchanged rather than risk corrupting the query.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sql_neatfmt-0.1.0.tar.gz.
File metadata
- Download URL: sql_neatfmt-0.1.0.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a835e0a9f8b119195a83e910cc54369606cec0790496fb5e130662c915e3df39
|
|
| MD5 |
6843f25a8b3d590da54011f58f8dd5a5
|
|
| BLAKE2b-256 |
d69ef6bfcf3836eaeb128b2278b2721c51ce55527514b2d1dc24e172f4fd6751
|
Provenance
The following attestation bundles were made for sql_neatfmt-0.1.0.tar.gz:
Publisher:
publish.yml on LuciusChen/sql-neatfmt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sql_neatfmt-0.1.0.tar.gz -
Subject digest:
a835e0a9f8b119195a83e910cc54369606cec0790496fb5e130662c915e3df39 - Sigstore transparency entry: 1409427605
- Sigstore integration time:
-
Permalink:
LuciusChen/sql-neatfmt@bf576c8c8c5196664f03267006be00e3f146b827 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/LuciusChen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bf576c8c8c5196664f03267006be00e3f146b827 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file sql_neatfmt-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sql_neatfmt-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5040071a1ca0e076de0b50647a1030d95fb0f87f00df1c3252ebce4d473c3348
|
|
| MD5 |
e7b01bf770fd255fda9f47e338a3914c
|
|
| BLAKE2b-256 |
67f2a7b49912ff87d3bfd03b510088343dc75826b1c854742ee1b43e463d0eb1
|
Provenance
The following attestation bundles were made for sql_neatfmt-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on LuciusChen/sql-neatfmt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sql_neatfmt-0.1.0-py3-none-any.whl -
Subject digest:
5040071a1ca0e076de0b50647a1030d95fb0f87f00df1c3252ebce4d473c3348 - Sigstore transparency entry: 1409427609
- Sigstore integration time:
-
Permalink:
LuciusChen/sql-neatfmt@bf576c8c8c5196664f03267006be00e3f146b827 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/LuciusChen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bf576c8c8c5196664f03267006be00e3f146b827 -
Trigger Event:
workflow_dispatch
-
Statement type: