Skip to main content

Bespoke SQL linter and formatter for DuckDB, powered by sqlglot

Project description

jarify

Bespoke SQL linter and formatter for DuckDB, built on sqlglot.

Existing SQL formatters can't be configured to enforce a specific team style, and none of them are DuckDB-aware. Jarify parses SQL with the DuckDB dialect and rewrites it through an opinionated, non-configurable formatter — no style debates, consistent output everywhere.

Installation

uv tool install jarify

Or run one-off without installing:

uvx jarify fmt path/to/query.sql

Upgrade

uv tool upgrade jarify

Pin to a specific version

uv tool install 'jarify==0.1.0'

Commands

jarify fmt — format SQL files

jarify fmt [OPTIONS] [FILES]...

Reads each file, formats it, and writes the result back in place.

Option Description
- Read from stdin
--check Exit non-zero if any file would change (useful in CI)
--diff Print a unified diff instead of rewriting files
--stdin-filename NAME Label to use in diff output when reading from stdin

Exit codes: 0 = all files already formatted, 1 = files were reformatted, 2 = error.

# Format a single file
jarify fmt query.sql

# Check all .sql files without modifying them (CI mode)
jarify fmt --check **/*.sql

# Preview changes as a diff
jarify fmt --diff query.sql

# Pipe from stdin
cat query.sql | jarify fmt -

jarify lint — lint SQL files

jarify lint [OPTIONS] [FILES]...

Reports style and semantic violations. Does not modify files.

jarify lint query.sql

jarify init — create a config file

jarify init

Writes a jarify.toml in the current directory. Config is internal to the tool — this is primarily useful for future per-project rule overrides.

jarify show-config — inspect active config

jarify show-config

Prints the effective configuration (syntax-highlighted TOML).

Style and lint rules

Jarify enforces a single, opinionated style. There are no knobs to turn. See the SQL Style Guide for the complete rule reference with bad/good examples for every formatting and lint rule.

Development

Requires mise and uv.

git clone https://github.com/amfaro/jarify.git
cd jarify
uv sync --all-groups

mise run test    # run tests
mise run lint    # ruff check
mise run check   # lint + test

Adding a new fixture test

  1. Create tests/fixtures/<category>/<name>.input.sql with the raw SQL
  2. Run uv run pytest tests/test_fixtures.py --update-fixtures to generate the expected output
  3. Review tests/fixtures/<category>/<name>.expected.sql and commit both files

Releases

Push a v* tag to trigger the publish workflow. GitHub Actions builds the wheel and sdist, publishes to PyPI via OIDC trusted publishing, attaches artifacts to a GitHub Release, and generates release notes automatically.

git tag v0.1.0
git push origin v0.1.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jarify-0.1.2.tar.gz (51.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jarify-0.1.2-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file jarify-0.1.2.tar.gz.

File metadata

  • Download URL: jarify-0.1.2.tar.gz
  • Upload date:
  • Size: 51.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for jarify-0.1.2.tar.gz
Algorithm Hash digest
SHA256 641778f8576a408896d48f508cfb8c90fac8c7a89c7516d6418f977bc3976e51
MD5 579e4c5029242fec74bdb4c3725293fc
BLAKE2b-256 fc2883243f8f569e68f86fe4c5e4c36c0128f23e5d048c1e8f3f1ecb700b8510

See more details on using hashes here.

File details

Details for the file jarify-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: jarify-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for jarify-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c31cfe6baa6ce6e5c415749976c00374577fbb51caf73d8ce5f96a95d2cec8ee
MD5 742c52104e327127a12c222d0d5d6e68
BLAKE2b-256 b92c1863e122eaabdfef52483da55353606985b26621562e4fc4aad1efebe12d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page