sqlalign 1.0.1__tar.gz → 1.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sqlalign-1.0.1 → sqlalign-1.0.2}/.github/workflows/ci.yml +27 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/.gitignore +1 -7
- {sqlalign-1.0.1 → sqlalign-1.0.2}/CHANGELOG.md +58 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/CONTRIBUTING.md +3 -1
- {sqlalign-1.0.1 → sqlalign-1.0.2}/PKG-INFO +28 -10
- {sqlalign-1.0.1 → sqlalign-1.0.2}/README.md +27 -9
- sqlalign-1.0.2/docs/CNAME +1 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/guide/cli.md +7 -5
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/guide/dialects.md +4 -3
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/guide/getting-started.md +9 -5
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/v1/cli.html +8 -6
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/v1/dialects.html +4 -3
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/v1/getting-started.html +9 -6
- sqlalign-1.0.2/docs/v1/search-index.json +1 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/pyproject.toml +2 -2
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/cli.py +61 -3
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/gui.py +3 -1
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/lint.py +26 -7
- sqlalign-1.0.2/src/sqlalign/py.typed +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/sqlfluffconfig.py +4 -1
- sqlalign-1.0.2/tests/test_atomic_writes.py +173 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_cli.py +41 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_docs_site.py +47 -4
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_lint_flag.py +31 -0
- sqlalign-1.0.2/tests/test_packaging.py +75 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_sqlfluff_coexistence.py +21 -5
- {sqlalign-1.0.1 → sqlalign-1.0.2}/uv.lock +5 -5
- sqlalign-1.0.1/docs/CNAME +0 -1
- sqlalign-1.0.1/docs/v1/search-index.json +0 -1
- {sqlalign-1.0.1 → sqlalign-1.0.2}/.github/workflows/release.yml +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/.sqlfluff +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/LICENSE +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/.nojekyll +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/guide/README.md +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/guide/architecture.md +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/guide/configuration.md +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/guide/faq.md +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/guide/style.md +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/index.html +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/sql-style-guide.md +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/v1/architecture.html +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/v1/configuration.html +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/v1/faq.html +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/v1/index.html +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/v1/settings.html +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/docs/v1/style.html +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/samples/queries.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/scripts/build_fixtures.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/__init__.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/align.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/bodylint.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/casing.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/commas.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/config.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/configfile.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/formatter.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/ir.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/keywordcase.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/__init__.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/case.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/comments.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/conditions.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/cte.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/ddl.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/dml.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/expr.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/fromjoin.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/grouporder.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/select.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/setop.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/subquery.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/layout/window.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/plpgsql.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/splitter.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/style.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/src/sqlalign/templating.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/conftest.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/docs/dbt.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/docs/fromblock.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/docs/hero.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/docs/plpgsql.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/01.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/02.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/03.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/04.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/05.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/06.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/07.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/08.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/09.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/10.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/11.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/12.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/13.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/14.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/15.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/16.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/17.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/18.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/19.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/20.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/21.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/22.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/23.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/24.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/25.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/26.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/27.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/28.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/expected/29.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/01.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/02.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/03.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/04.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/05.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/06.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/07.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/08.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/09.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/10.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/11.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/12.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/13.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/14.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/15.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/16.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/17.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/18.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/19.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/20.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/21.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/22.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/23.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/24.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/25.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/26.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/27.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/28.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/fixtures/input/29.sql +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_align.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_align_off.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_align_targets.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_ast_equiv.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_axis_matrix.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_blank_lines.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_bodylint.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_boolean_position.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_casing.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_clause_order.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_clauses.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_comma_joins_lateral_udf.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_comma_position.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_comment_and_procedure_bugs.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_comments.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_comments_in_predicates.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_configfile.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_construct_sweep.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_coverage_round_2.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_ddl.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_dialect_guard.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_distinct.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_dml.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_docs_examples.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_expr.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_fetch_and_lateral_subquery.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_file_selection.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_fromjoin.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_golden.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_gui.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_keyword_case.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_knob_combinations.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_line_endings.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_nested_constructs.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_no_silent_declines.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_on_placement.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_pivot.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_plpgsql.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_presets.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_quoted_column_aliases.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_remaining_constructs.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_report.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_river.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_robustness.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_safety.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_select_placement.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_skip.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_splitter.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_sqlfluff_gate.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_style_knobs.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_subquery.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_table_alias.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_table_names.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_templating.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_trailing_punctuation.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_tsql.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_unaliased_tables.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_upstream_and_tail.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_values_and_joins.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tests/test_width_off_and_body_blanks.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tools/build_docs.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tools/docs.css +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tools/docs.js +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tools/docs_settings.py +0 -0
- {sqlalign-1.0.1 → sqlalign-1.0.2}/tools/shots.py +0 -0
|
@@ -54,6 +54,33 @@ jobs:
|
|
|
54
54
|
- name: Goldens are byte-exact
|
|
55
55
|
run: uv run pytest -q -k goldens_unchanged
|
|
56
56
|
|
|
57
|
+
# `--lint` supports a RANGE of sqlfluff, but the matrix above only ever runs
|
|
58
|
+
# the top of it. The rule names and config keys the coexistence config emits
|
|
59
|
+
# are versioned surface, and `version_warning` is deliberately silent for a
|
|
60
|
+
# sqlfluff older than the one the mappings were checked against -- so if the
|
|
61
|
+
# floor broke, a user on it would get a wrong config and no warning at all.
|
|
62
|
+
# Nothing but this job would notice.
|
|
63
|
+
sqlfluff-floor:
|
|
64
|
+
runs-on: ubuntu-latest
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v4
|
|
67
|
+
- uses: astral-sh/setup-uv@v5
|
|
68
|
+
with:
|
|
69
|
+
enable-cache: true
|
|
70
|
+
- run: uv sync --locked --all-extras
|
|
71
|
+
|
|
72
|
+
# The oldest release the `lint` extra allows. Pinned exactly: "the floor"
|
|
73
|
+
# is only meaningful if it is the floor that ran.
|
|
74
|
+
- name: Install the oldest supported sqlfluff
|
|
75
|
+
run: uv pip install 'sqlfluff==4.2.0'
|
|
76
|
+
|
|
77
|
+
- name: The coexistence config still holds
|
|
78
|
+
run: |
|
|
79
|
+
uv run --no-sync python -c "import sqlfluff; print(sqlfluff.__version__)"
|
|
80
|
+
uv run --no-sync pytest -q tests/test_sqlfluff_coexistence.py \
|
|
81
|
+
tests/test_lint_flag.py \
|
|
82
|
+
tests/test_bodylint.py
|
|
83
|
+
|
|
57
84
|
# docs/v1 is generated and committed, so a stale build ships. Rebuilding here
|
|
58
85
|
# proves the committed site matches its generator.
|
|
59
86
|
docs:
|
|
@@ -14,11 +14,5 @@ build/
|
|
|
14
14
|
# the published site.
|
|
15
15
|
docs/superpowers/
|
|
16
16
|
|
|
17
|
-
# scratch scripts
|
|
17
|
+
# scratch scripts must not be committed
|
|
18
18
|
/probe_*.py
|
|
19
|
-
|
|
20
|
-
# Agent/assistant working files, if any ever land here
|
|
21
|
-
CLAUDE.md
|
|
22
|
-
AGENTS.md
|
|
23
|
-
.claude/
|
|
24
|
-
.superpowers/
|
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
**An interrupted run could truncate the file it was formatting.** Writing with
|
|
8
|
+
`open(path, "w")` empties the file before the replacement is written, so a run
|
|
9
|
+
stopped part way through -- Ctrl-C over a large repository, a full disk, a
|
|
10
|
+
killed process -- left some file holding a prefix of its formatted self, with
|
|
11
|
+
the original gone. Files are now written to a neighbour and renamed into place,
|
|
12
|
+
so what is on disk is either the whole old file or the whole new one. Symlinks
|
|
13
|
+
are written through rather than replaced, and permissions are carried across.
|
|
14
|
+
|
|
15
|
+
**A file that was not UTF-8 raised a traceback and aborted the run.** The read
|
|
16
|
+
is UTF-8, and a `UnicodeDecodeError` is not an `OSError`, so it escaped the
|
|
17
|
+
per-file handler and took the whole invocation with it — every file after the
|
|
18
|
+
first undecodable one was silently never formatted. Such a file is now reported
|
|
19
|
+
and left exactly as it is: guessing an encoding would mean writing it back in a
|
|
20
|
+
different one, which is the kind of change sqlalign exists not to make.
|
|
21
|
+
|
|
22
|
+
**An unwritable file raised a traceback and aborted the run.** A read-only file
|
|
23
|
+
now reports `sqlalign: [Errno 13] Permission denied: <path>`, exits `2`, and
|
|
24
|
+
leaves the remaining files to process -- which is what the exit-code table
|
|
25
|
+
already documented.
|
|
26
|
+
|
|
27
|
+
`py.typed` was missing, so every type checker skipped the package while the
|
|
28
|
+
`Typing :: Typed` classifier said the opposite. sqlalign is annotated and
|
|
29
|
+
`format_sql` is importable; both now work as advertised.
|
|
30
|
+
|
|
31
|
+
`--gui`'s missing-tkinter message went to stdout rather than stderr.
|
|
32
|
+
|
|
33
|
+
`--lint` no longer warns about a sqlfluff patch release. The coexistence config
|
|
34
|
+
is checked against a known sqlfluff, and any difference warned; sqlfluff 4.3.0
|
|
35
|
+
then shipped, so every run printed a note about a release that had moved nothing
|
|
36
|
+
sqlalign uses. The check now compares the series, and is silent for a sqlfluff
|
|
37
|
+
older than the checked one -- the floor on the `lint` extra bounds that, and CI
|
|
38
|
+
now runs the coexistence tests against it. The mappings are verified against
|
|
39
|
+
sqlfluff 4.3.0.
|
|
40
|
+
|
|
41
|
+
### Documentation
|
|
42
|
+
|
|
43
|
+
`--report` and `--max-declines` add output without changing the mode, so on
|
|
44
|
+
their own they rewrite the files they counted. The dialects guide told you to
|
|
45
|
+
run `sqlalign --report` over your own SQL to see what declined, which would have
|
|
46
|
+
reformatted the repository you were surveying. Both the guide and the flag's
|
|
47
|
+
help now say to pair it with `--check`.
|
|
48
|
+
|
|
49
|
+
Install instructions said `uv tool install .`, which installs from a clone. That
|
|
50
|
+
was the only option before the package was published; it is now
|
|
51
|
+
`pip install sqlalign`. The CI example in the guide told you to run that same
|
|
52
|
+
command inside your own repository, where it would have tried to install your
|
|
53
|
+
SQL repo as a Python package.
|
|
54
|
+
|
|
55
|
+
Also corrected: `--preset` documented four of its six values (`gitlab` and
|
|
56
|
+
`river` were missing), three places still said the project had no CI, and the
|
|
57
|
+
README linked the settings reference as a raw HTML file rather than to the
|
|
58
|
+
published site. Documented choice lists are now checked against the argument
|
|
59
|
+
parser by a test.
|
|
60
|
+
|
|
3
61
|
## 1.0.1
|
|
4
62
|
|
|
5
63
|
No functional change. `1.0.0` was tagged before the package was ever published,
|
|
@@ -11,7 +11,9 @@ uv run pytest -q # ~3,300 tests, about 40 seconds
|
|
|
11
11
|
uv run ruff check .
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Both must be clean before a pull request.
|
|
14
|
+
Both must be clean before a pull request. CI runs the same two checks on
|
|
15
|
+
Python 3.12 and 3.13, plus the goldens, the docs site and the oldest
|
|
16
|
+
supported sqlfluff, each as its own job so a red build says why.
|
|
15
17
|
|
|
16
18
|
## The goldens are the specification
|
|
17
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: sqlalign
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: A SQL formatter that cannot change what your SQL means
|
|
5
5
|
Project-URL: Homepage, https://sqlalign.lumaru.app/
|
|
6
6
|
Project-URL: Documentation, https://sqlalign.lumaru.app/v1/
|
|
@@ -139,14 +139,29 @@ LEFT JOIN shipping_addresses addr ON addr.order_id = ord.order_id
|
|
|
139
139
|
## Install
|
|
140
140
|
|
|
141
141
|
```sh
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
pip install sqlalign
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
That puts a `sqlalign` command on your PATH. To keep it out of a project's
|
|
146
|
+
environment, `uv tool install sqlalign` does the same thing in isolation.
|
|
147
|
+
|
|
148
|
+
`--lint` runs sqlfluff over the formatted result and needs the optional extra:
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
pip install 'sqlalign[lint]'
|
|
145
152
|
```
|
|
146
153
|
|
|
147
154
|
Requires Python ≥ 3.12. Runtime dependency: `sqlglot` (pinned to the 30.14.x
|
|
148
155
|
line — the layout engine depends on exact AST shapes; see `pyproject.toml`).
|
|
149
156
|
|
|
157
|
+
To work on sqlalign itself, install from a clone instead — that adds the dev
|
|
158
|
+
tools (`pytest`, `ruff`, `sqlfluff`):
|
|
159
|
+
|
|
160
|
+
```sh
|
|
161
|
+
git clone https://github.com/pua2/sqlalign && cd sqlalign
|
|
162
|
+
uv sync
|
|
163
|
+
```
|
|
164
|
+
|
|
150
165
|
## Usage
|
|
151
166
|
|
|
152
167
|
```sh
|
|
@@ -296,7 +311,7 @@ would otherwise mean a team believes it has a setting it doesn't have.
|
|
|
296
311
|
| `--lint` | off | after formatting, run sqlfluff over the result (needs `pip install 'sqlalign[lint]'`) |
|
|
297
312
|
| `--body-blank-lines N` | `1` | blank lines between the elements of a `$$` body |
|
|
298
313
|
| `--gui` | — | *(experimental)* open a settings panel with a live preview, and exit |
|
|
299
|
-
| `--report` | off | print a coverage summary: how many statements formatted, and what the rest declined on |
|
|
314
|
+
| `--report` | off | print a coverage summary: how many statements formatted, and what the rest declined on. Adds output without changing the mode — pair with `--check` to survey without writing |
|
|
300
315
|
| `--max-declines N` | — | exit 1 if more than N statements pass through unformatted (implies `--report`) |
|
|
301
316
|
| `--show-config` | off | print effective settings as TOML and exit |
|
|
302
317
|
| `--no-strict-config` | off | warn on unknown config keys instead of failing |
|
|
@@ -363,7 +378,9 @@ The fixtures are the spec — grow them, never weaken them:
|
|
|
363
378
|
|
|
364
379
|
## Documentation
|
|
365
380
|
|
|
366
|
-
The
|
|
381
|
+
The documentation site is at **<https://sqlalign.lumaru.app/>**.
|
|
382
|
+
|
|
383
|
+
The [settings reference](https://sqlalign.lumaru.app/v1/settings.html) is the page to start with: it
|
|
367
384
|
shows every setting with the same SQL rendered under each of its values.
|
|
368
385
|
|
|
369
386
|
To read the site locally:
|
|
@@ -372,8 +389,8 @@ To read the site locally:
|
|
|
372
389
|
python3 -m http.server -d docs 8000 # then open http://localhost:8000/
|
|
373
390
|
```
|
|
374
391
|
|
|
375
|
-
**The site is generated and committed.**
|
|
376
|
-
|
|
392
|
+
**The site is generated and committed.** GitHub Pages runs no build step, so the
|
|
393
|
+
HTML in `docs/v1/` is what ships. Prose is authored in
|
|
377
394
|
`docs/guide/*.md`; every configuration example is produced by *running the
|
|
378
395
|
formatter* at build time, so no example on the site can drift from what the tool
|
|
379
396
|
does. After editing a guide page, a setting, or anything that changes output:
|
|
@@ -393,8 +410,9 @@ working untouched.
|
|
|
393
410
|
## Contributing
|
|
394
411
|
|
|
395
412
|
See [CONTRIBUTING.md](CONTRIBUTING.md). In short: `uv sync`, then `uv run pytest
|
|
396
|
-
-q` and `uv run ruff check .` must both be clean
|
|
397
|
-
`tests/fixtures/expected/` are the
|
|
413
|
+
-q` and `uv run ruff check .` must both be clean — CI runs the same checks on
|
|
414
|
+
every pull request. The goldens in `tests/fixtures/expected/` are the
|
|
415
|
+
specification, not snapshots.
|
|
398
416
|
|
|
399
417
|
Release notes are in [CHANGELOG.md](CHANGELOG.md).
|
|
400
418
|
|
|
@@ -110,14 +110,29 @@ LEFT JOIN shipping_addresses addr ON addr.order_id = ord.order_id
|
|
|
110
110
|
## Install
|
|
111
111
|
|
|
112
112
|
```sh
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
pip install sqlalign
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
That puts a `sqlalign` command on your PATH. To keep it out of a project's
|
|
117
|
+
environment, `uv tool install sqlalign` does the same thing in isolation.
|
|
118
|
+
|
|
119
|
+
`--lint` runs sqlfluff over the formatted result and needs the optional extra:
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
pip install 'sqlalign[lint]'
|
|
116
123
|
```
|
|
117
124
|
|
|
118
125
|
Requires Python ≥ 3.12. Runtime dependency: `sqlglot` (pinned to the 30.14.x
|
|
119
126
|
line — the layout engine depends on exact AST shapes; see `pyproject.toml`).
|
|
120
127
|
|
|
128
|
+
To work on sqlalign itself, install from a clone instead — that adds the dev
|
|
129
|
+
tools (`pytest`, `ruff`, `sqlfluff`):
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
git clone https://github.com/pua2/sqlalign && cd sqlalign
|
|
133
|
+
uv sync
|
|
134
|
+
```
|
|
135
|
+
|
|
121
136
|
## Usage
|
|
122
137
|
|
|
123
138
|
```sh
|
|
@@ -267,7 +282,7 @@ would otherwise mean a team believes it has a setting it doesn't have.
|
|
|
267
282
|
| `--lint` | off | after formatting, run sqlfluff over the result (needs `pip install 'sqlalign[lint]'`) |
|
|
268
283
|
| `--body-blank-lines N` | `1` | blank lines between the elements of a `$$` body |
|
|
269
284
|
| `--gui` | — | *(experimental)* open a settings panel with a live preview, and exit |
|
|
270
|
-
| `--report` | off | print a coverage summary: how many statements formatted, and what the rest declined on |
|
|
285
|
+
| `--report` | off | print a coverage summary: how many statements formatted, and what the rest declined on. Adds output without changing the mode — pair with `--check` to survey without writing |
|
|
271
286
|
| `--max-declines N` | — | exit 1 if more than N statements pass through unformatted (implies `--report`) |
|
|
272
287
|
| `--show-config` | off | print effective settings as TOML and exit |
|
|
273
288
|
| `--no-strict-config` | off | warn on unknown config keys instead of failing |
|
|
@@ -334,7 +349,9 @@ The fixtures are the spec — grow them, never weaken them:
|
|
|
334
349
|
|
|
335
350
|
## Documentation
|
|
336
351
|
|
|
337
|
-
The
|
|
352
|
+
The documentation site is at **<https://sqlalign.lumaru.app/>**.
|
|
353
|
+
|
|
354
|
+
The [settings reference](https://sqlalign.lumaru.app/v1/settings.html) is the page to start with: it
|
|
338
355
|
shows every setting with the same SQL rendered under each of its values.
|
|
339
356
|
|
|
340
357
|
To read the site locally:
|
|
@@ -343,8 +360,8 @@ To read the site locally:
|
|
|
343
360
|
python3 -m http.server -d docs 8000 # then open http://localhost:8000/
|
|
344
361
|
```
|
|
345
362
|
|
|
346
|
-
**The site is generated and committed.**
|
|
347
|
-
|
|
363
|
+
**The site is generated and committed.** GitHub Pages runs no build step, so the
|
|
364
|
+
HTML in `docs/v1/` is what ships. Prose is authored in
|
|
348
365
|
`docs/guide/*.md`; every configuration example is produced by *running the
|
|
349
366
|
formatter* at build time, so no example on the site can drift from what the tool
|
|
350
367
|
does. After editing a guide page, a setting, or anything that changes output:
|
|
@@ -364,8 +381,9 @@ working untouched.
|
|
|
364
381
|
## Contributing
|
|
365
382
|
|
|
366
383
|
See [CONTRIBUTING.md](CONTRIBUTING.md). In short: `uv sync`, then `uv run pytest
|
|
367
|
-
-q` and `uv run ruff check .` must both be clean
|
|
368
|
-
`tests/fixtures/expected/` are the
|
|
384
|
+
-q` and `uv run ruff check .` must both be clean — CI runs the same checks on
|
|
385
|
+
every pull request. The goldens in `tests/fixtures/expected/` are the
|
|
386
|
+
specification, not snapshots.
|
|
369
387
|
|
|
370
388
|
Release notes are in [CHANGELOG.md](CHANGELOG.md).
|
|
371
389
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sqlalign.lumaru.app
|
|
@@ -113,16 +113,18 @@ else is an error unless you pass `--no-strict-config`.
|
|
|
113
113
|
`neq_style` · `on_placement` · `preset` · `protect_templating` · `river_gutter` ·
|
|
114
114
|
`select_indent` · `select_placement` · `table_alias_style` · `width`
|
|
115
115
|
|
|
116
|
-
`--dialect` and `--line-ending` are the only settings with no config key.
|
|
117
|
-
|
|
118
|
-
`--no-protect-templating` is `protect_templating = false`,
|
|
119
|
-
is `format_dollar_bodies = false`.
|
|
116
|
+
`--dialect` and `--line-ending` are the only settings with no config key. Three
|
|
117
|
+
of the four `--no-*` flags map onto the positive keys: `--no-align` is
|
|
118
|
+
`align = false`, `--no-protect-templating` is `protect_templating = false`, and
|
|
119
|
+
`--no-format-bodies` is `format_dollar_bodies = false`. The fourth,
|
|
120
|
+
`--no-strict-config`, is not a style setting at all — it changes how the config
|
|
121
|
+
file itself is read.
|
|
120
122
|
|
|
121
123
|
## Style
|
|
122
124
|
|
|
123
125
|
| Flag | Default | What it does |
|
|
124
126
|
|---|---|---|
|
|
125
|
-
| `--preset {compact,dbt,house,trailing}` | none (the `house` defaults) | Named starting point. Sets a **base** that config keys and flags then layer on top of, so `--preset compact --comma-position trailing` means both. Not passing it leaves any `preset` key in your config file in force. |
|
|
127
|
+
| `--preset {compact,dbt,gitlab,house,river,trailing}` | none (the `house` defaults) | Named starting point. Sets a **base** that config keys and flags then layer on top of, so `--preset compact --comma-position trailing` means both. Not passing it leaves any `preset` key in your config file in force. |
|
|
126
128
|
| `--width WIDTH` | `100` | Target line width for wrapping decisions. Not a hard cap: a construct anchored deep in an indent gets a floor of `anchor + 60`, plus 5 characters of grace, so alignment is never sacrificed to shave two columns. |
|
|
127
129
|
| `--blank-lines-between-statements N` | unset | Force N blank lines between every pair of statements. Unset is the house rule: exactly one blank line between two **multi-line** statements and none otherwise, so a run of one-line `GRANT`s stays a block. `0` removes them all. |
|
|
128
130
|
| `--no-align` | off *(aligned)* | Emit one space between tokens instead of padding them into columns. Same line structure, no padding — this is what 9 of 10 published SQL style guides call for. |
|
|
@@ -171,9 +171,10 @@ The check renders the node and looks at what comes out, rather than consulting a
|
|
|
171
171
|
list of dialects — so if sqlglot ever grows Postgres support, this stops
|
|
172
172
|
declining on its own.
|
|
173
173
|
|
|
174
|
-
Run `sqlalign --report` over your own SQL rather than trusting this
|
|
175
|
-
counts what actually declined, ranked, so you can see whether any of
|
|
176
|
-
to you.
|
|
174
|
+
Run `sqlalign --report --check` over your own SQL rather than trusting this
|
|
175
|
+
list — it counts what actually declined, ranked, so you can see whether any of
|
|
176
|
+
it matters to you. `--check` is what keeps it a survey: `--report` adds output
|
|
177
|
+
without changing the mode, so on its own it would rewrite the files it counted.
|
|
177
178
|
|
|
178
179
|
The legacy comma join — `FROM a, b` — formats, and is worth a note because it
|
|
179
180
|
was once declined. It parses as a join with no condition, exactly like
|
|
@@ -16,7 +16,7 @@ sqlalign needs **Python 3.12 or newer** and has exactly one runtime dependency:
|
|
|
16
16
|
shapes, so the pin is deliberate — see the comment in `pyproject.toml`.)
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
|
-
|
|
19
|
+
pip install sqlalign
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
That installs a `sqlalign` command on your PATH. Check it:
|
|
@@ -25,10 +25,14 @@ That installs a `sqlalign` command on your PATH. Check it:
|
|
|
25
25
|
sqlalign --help
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
`uv tool install sqlalign` does the same while keeping it out of your project's
|
|
29
|
+
environment.
|
|
30
|
+
|
|
31
|
+
For development on sqlalign itself, work from a clone instead — this adds the
|
|
32
|
+
dev tools (`pytest`, `ruff`, `sqlfluff`):
|
|
30
33
|
|
|
31
34
|
```sh
|
|
35
|
+
git clone https://github.com/pua2/sqlalign && cd sqlalign
|
|
32
36
|
uv sync
|
|
33
37
|
```
|
|
34
38
|
|
|
@@ -490,12 +494,12 @@ which is exactly what a CI runner treats as a failure:
|
|
|
490
494
|
sqlalign --check .
|
|
491
495
|
```
|
|
492
496
|
|
|
493
|
-
Wrapped in a job step
|
|
497
|
+
Wrapped in a job step:
|
|
494
498
|
|
|
495
499
|
```yaml
|
|
496
500
|
- name: Check SQL formatting
|
|
497
501
|
run: |
|
|
498
|
-
|
|
502
|
+
pip install sqlalign
|
|
499
503
|
sqlalign --check .
|
|
500
504
|
```
|
|
501
505
|
|
|
@@ -187,7 +187,7 @@ dl.meta dd { margin:0; }
|
|
|
187
187
|
<a href="dialects.html">Dialects</a>
|
|
188
188
|
<a href="architecture.html">Architecture</a>
|
|
189
189
|
<a href="faq.html">FAQ</a></nav>
|
|
190
|
-
<main id="main"><h2 id="all-flags">All flags<a class="anchor" href="#all-flags">#</a></h2><p>Generated from the parser, so it cannot fall behind it. The sections below explain the ones that need more than a line.</p><table><thead><tr><th>Flag</th><th>Description</th></tr></thead><tbody><tr><td><code>-h</code>, <code>--help</code></td><td>show this help message and exit</td></tr><tr><td><code>--version</code></td><td>print the version and exit</td></tr><tr><td><code>--check</code></td><td>do not write; exit 1 if any file would change</td></tr><tr><td><code>--stdout</code></td><td>write the result to stdout instead of the file</td></tr><tr><td><code>--diff</code></td><td>write nothing; print a unified diff of what would change (exit 1 if anything would)</td></tr><tr><td><code>--dialect</code> <code>postgres</code>, <code>redshift</code>, <code>tsql</code></td><td>the SQL dialect to parse and print (default: postgres)</td></tr><tr><td><code>--line-ending</code> <code>auto</code>, <code>lf</code>, <code>crlf</code></td><td>line endings to write: auto preserves the file's own (default)</td></tr><tr><td><code>--config</code></td><td>use this config file instead of discovering one</td></tr><tr><td><code>--exclude</code></td><td>skip files matching this glob when expanding a directory (repeatable; also settable as <code>exclude</code> in a config file)</td></tr><tr><td><code>--isolated</code></td><td>ignore any config file and use the built-in defaults</td></tr><tr><td><code>--show-config</code></td><td>print the effective settings as TOML and exit</td></tr><tr><td><code>--gui</code></td><td>(experimental) open the settings panel with a live preview, and exit</td></tr><tr><td><code>--report</code></td><td>print a coverage summary: how many statements were formatted, and what the rest declined on</td></tr><tr><td><code>--max-declines</code></td><td>exit 1 if more than N statements are passed through unformatted (implies --report)</td></tr><tr><td><code>--lint</code></td><td>after formatting, run sqlfluff over the result (needs the optional <code>sqlalign[lint]</code> extra)</td></tr><tr><td><code>--print-sqlfluff-config</code></td><td>print a .sqlfluff that lets sqlfluff run alongside sqlalign without fighting it, and exit</td></tr><tr><td><code>--no-strict-config</code></td><td>warn on unknown config keys instead of failing</td></tr><tr><td><code>--preset</code> <code>compact</code>, <code>dbt</code>, <code>gitlab</code>, <code>house</code>, <code>river</code>, <code>trailing</code></td><td>named starting point; config keys and flags layer on top</td></tr><tr><td><code>--width</code></td><td>column the formatter tries to stay inside; 0 turns it off</td></tr><tr><td><code>--blank-lines-between-statements</code></td><td>force N blank lines between every pair of statements (default: one only between two multi-line statements)</td></tr><tr><td><code>--no-align</code></td><td>emit one space between tokens instead of aligning them into columns (same line structure, no padding)</td></tr><tr><td><code>--no-protect-templating</code></td><td>do not mask Jinja/dbt template expressions before formatting</td></tr><tr><td><code>--no-format-bodies</code></td><td>leave dollar-quoted ($$) procedure and function bodies untouched</td></tr><tr><td><code>--align-targets</code></td><td>comma-separated alignment targets to keep. Default is every target except table_names, which is opt-in because it pads the FROM/JOIN keyword out to a shared table column. Valid: aliases, table_names, operators, join_conditions, case_results, column_types, column_constraints</td></tr><tr><td><code>--comma-position</code> <code>leading</code>, <code>trailing</code></td><td>where the separator comma sits in a stacked list (default: leading)</td></tr><tr><td><code>--boolean-operator-position</code> <code>leading</code>, <code>trailing</code></td><td>where AND/OR sit when a predicate spans lines (default: leading)</td></tr><tr><td><code>--on-placement</code> <code>inline</code>, <code>own_line</code></td><td>whether a JOIN ON rides the table line or drops below it</td></tr><tr><td><code>--select-placement</code> <code>inline</code>, <code>own_line</code></td><td>whether the first select item rides the SELECT line</td></tr><tr><td><code>--select-indent</code></td><td>columns the select list indents under --select-placement own_line (default: 2)</td></tr><tr><td><code>--body-blank-lines</code></td><td>blank lines between the elements of a $$ body (default: 1)</td></tr><tr><td><code>--clause-keyword-align</code> <code>left</code>, <code>river</code></td><td>root clause keywords flush left, or right-aligned to a river</td></tr><tr><td><code>--river-gutter</code></td><td>column a river right-aligns clause keywords to (default: 6)</td></tr><tr><td><code>--keyword-case</code> <code>upper</code>, <code>lower</code></td><td>case for keywords, function names and types (default: upper)</td></tr><tr><td><code>--neq-style</code> <code>!=</code>, <code><></code></td><td>spelling for the not-equal operator (default: !=)</td></tr><tr><td><code>--table-alias-style</code> <code>bare</code>, <code>as</code></td><td>print a table alias as <code>t a</code> (bare) or <code>t AS a</code></td></tr><tr><td><code>--decimal-style</code> <code>NUMERIC</code>, <code>DECIMAL</code></td><td>spelling for the NUMERIC/DECIMAL type (default: NUMERIC)</td></tr></tbody></table><pre><code>sqlalign [OPTIONS] FILE_OR_DIRECTORY...
|
|
190
|
+
<main id="main"><h2 id="all-flags">All flags<a class="anchor" href="#all-flags">#</a></h2><p>Generated from the parser, so it cannot fall behind it. The sections below explain the ones that need more than a line.</p><table><thead><tr><th>Flag</th><th>Description</th></tr></thead><tbody><tr><td><code>-h</code>, <code>--help</code></td><td>show this help message and exit</td></tr><tr><td><code>--version</code></td><td>print the version and exit</td></tr><tr><td><code>--check</code></td><td>do not write; exit 1 if any file would change</td></tr><tr><td><code>--stdout</code></td><td>write the result to stdout instead of the file</td></tr><tr><td><code>--diff</code></td><td>write nothing; print a unified diff of what would change (exit 1 if anything would)</td></tr><tr><td><code>--dialect</code> <code>postgres</code>, <code>redshift</code>, <code>tsql</code></td><td>the SQL dialect to parse and print (default: postgres)</td></tr><tr><td><code>--line-ending</code> <code>auto</code>, <code>lf</code>, <code>crlf</code></td><td>line endings to write: auto preserves the file's own (default)</td></tr><tr><td><code>--config</code></td><td>use this config file instead of discovering one</td></tr><tr><td><code>--exclude</code></td><td>skip files matching this glob when expanding a directory (repeatable; also settable as <code>exclude</code> in a config file)</td></tr><tr><td><code>--isolated</code></td><td>ignore any config file and use the built-in defaults</td></tr><tr><td><code>--show-config</code></td><td>print the effective settings as TOML and exit</td></tr><tr><td><code>--gui</code></td><td>(experimental) open the settings panel with a live preview, and exit</td></tr><tr><td><code>--report</code></td><td>print a coverage summary: how many statements were formatted, and what the rest declined on. Adds output without changing the mode, so on its own it still rewrites; pair it with <code>--check</code> to survey without writing</td></tr><tr><td><code>--max-declines</code></td><td>exit 1 if more than N statements are passed through unformatted (implies --report)</td></tr><tr><td><code>--lint</code></td><td>after formatting, run sqlfluff over the result (needs the optional <code>sqlalign[lint]</code> extra)</td></tr><tr><td><code>--print-sqlfluff-config</code></td><td>print a .sqlfluff that lets sqlfluff run alongside sqlalign without fighting it, and exit</td></tr><tr><td><code>--no-strict-config</code></td><td>warn on unknown config keys instead of failing</td></tr><tr><td><code>--preset</code> <code>compact</code>, <code>dbt</code>, <code>gitlab</code>, <code>house</code>, <code>river</code>, <code>trailing</code></td><td>named starting point; config keys and flags layer on top</td></tr><tr><td><code>--width</code></td><td>column the formatter tries to stay inside; 0 turns it off</td></tr><tr><td><code>--blank-lines-between-statements</code></td><td>force N blank lines between every pair of statements (default: one only between two multi-line statements)</td></tr><tr><td><code>--no-align</code></td><td>emit one space between tokens instead of aligning them into columns (same line structure, no padding)</td></tr><tr><td><code>--no-protect-templating</code></td><td>do not mask Jinja/dbt template expressions before formatting</td></tr><tr><td><code>--no-format-bodies</code></td><td>leave dollar-quoted ($$) procedure and function bodies untouched</td></tr><tr><td><code>--align-targets</code></td><td>comma-separated alignment targets to keep. Default is every target except table_names, which is opt-in because it pads the FROM/JOIN keyword out to a shared table column. Valid: aliases, table_names, operators, join_conditions, case_results, column_types, column_constraints</td></tr><tr><td><code>--comma-position</code> <code>leading</code>, <code>trailing</code></td><td>where the separator comma sits in a stacked list (default: leading)</td></tr><tr><td><code>--boolean-operator-position</code> <code>leading</code>, <code>trailing</code></td><td>where AND/OR sit when a predicate spans lines (default: leading)</td></tr><tr><td><code>--on-placement</code> <code>inline</code>, <code>own_line</code></td><td>whether a JOIN ON rides the table line or drops below it</td></tr><tr><td><code>--select-placement</code> <code>inline</code>, <code>own_line</code></td><td>whether the first select item rides the SELECT line</td></tr><tr><td><code>--select-indent</code></td><td>columns the select list indents under --select-placement own_line (default: 2)</td></tr><tr><td><code>--body-blank-lines</code></td><td>blank lines between the elements of a $$ body (default: 1)</td></tr><tr><td><code>--clause-keyword-align</code> <code>left</code>, <code>river</code></td><td>root clause keywords flush left, or right-aligned to a river</td></tr><tr><td><code>--river-gutter</code></td><td>column a river right-aligns clause keywords to (default: 6)</td></tr><tr><td><code>--keyword-case</code> <code>upper</code>, <code>lower</code></td><td>case for keywords, function names and types (default: upper)</td></tr><tr><td><code>--neq-style</code> <code>!=</code>, <code><></code></td><td>spelling for the not-equal operator (default: !=)</td></tr><tr><td><code>--table-alias-style</code> <code>bare</code>, <code>as</code></td><td>print a table alias as <code>t a</code> (bare) or <code>t AS a</code></td></tr><tr><td><code>--decimal-style</code> <code>NUMERIC</code>, <code>DECIMAL</code></td><td>spelling for the NUMERIC/DECIMAL type (default: NUMERIC)</td></tr></tbody></table><pre><code>sqlalign [OPTIONS] FILE_OR_DIRECTORY...
|
|
191
191
|
</code></pre>
|
|
192
192
|
<p>Every flag below is the complete set — this page is written against
|
|
193
193
|
<code>sqlalign --help</code> and nothing is omitted. New to the tool? Start with
|
|
@@ -355,10 +355,12 @@ else is an error unless you pass <code>--no-strict-config</code>.</p>
|
|
|
355
355
|
<code>decimal_style</code> · <code>exclude</code> · <code>format_dollar_bodies</code> · <code>keyword_case</code> ·
|
|
356
356
|
<code>neq_style</code> · <code>on_placement</code> · <code>preset</code> · <code>protect_templating</code> · <code>river_gutter</code> ·
|
|
357
357
|
<code>select_indent</code> · <code>select_placement</code> · <code>table_alias_style</code> · <code>width</code></p>
|
|
358
|
-
<p><code>--dialect</code> and <code>--line-ending</code> are the only settings with no config key.
|
|
359
|
-
|
|
360
|
-
<code>--no-protect-templating</code> is <code>protect_templating = false</code>,
|
|
361
|
-
is <code>format_dollar_bodies = false</code
|
|
358
|
+
<p><code>--dialect</code> and <code>--line-ending</code> are the only settings with no config key. Three
|
|
359
|
+
of the four <code>--no-*</code> flags map onto the positive keys: <code>--no-align</code> is
|
|
360
|
+
<code>align = false</code>, <code>--no-protect-templating</code> is <code>protect_templating = false</code>, and
|
|
361
|
+
<code>--no-format-bodies</code> is <code>format_dollar_bodies = false</code>. The fourth,
|
|
362
|
+
<code>--no-strict-config</code>, is not a style setting at all — it changes how the config
|
|
363
|
+
file itself is read.</p>
|
|
362
364
|
<h2 id="style">Style<a class="anchor" href="#style" aria-label="Link to this section">#</a></h2>
|
|
363
365
|
<table>
|
|
364
366
|
<thead>
|
|
@@ -370,7 +372,7 @@ is <code>format_dollar_bodies = false</code>.</p>
|
|
|
370
372
|
</thead>
|
|
371
373
|
<tbody>
|
|
372
374
|
<tr>
|
|
373
|
-
<td><code>--preset {compact,dbt,house,trailing}</code></td>
|
|
375
|
+
<td><code>--preset {compact,dbt,gitlab,house,river,trailing}</code></td>
|
|
374
376
|
<td>none (the <code>house</code> defaults)</td>
|
|
375
377
|
<td>Named starting point. Sets a <strong>base</strong> that config keys and flags then layer on top of, so <code>--preset compact --comma-position trailing</code> means both. Not passing it leaves any <code>preset</code> key in your config file in force.</td>
|
|
376
378
|
</tr>
|
|
@@ -338,9 +338,10 @@ FROM (SELECT a
|
|
|
338
338
|
<p>The check renders the node and looks at what comes out, rather than consulting a
|
|
339
339
|
list of dialects — so if sqlglot ever grows Postgres support, this stops
|
|
340
340
|
declining on its own.</p>
|
|
341
|
-
<p>Run <code>sqlalign --report</code> over your own SQL rather than trusting this
|
|
342
|
-
counts what actually declined, ranked, so you can see whether any of
|
|
343
|
-
to you
|
|
341
|
+
<p>Run <code>sqlalign --report --check</code> over your own SQL rather than trusting this
|
|
342
|
+
list — it counts what actually declined, ranked, so you can see whether any of
|
|
343
|
+
it matters to you. <code>--check</code> is what keeps it a survey: <code>--report</code> adds output
|
|
344
|
+
without changing the mode, so on its own it would rewrite the files it counted.</p>
|
|
344
345
|
<p>The legacy comma join — <code>FROM a, b</code> — formats, and is worth a note because it
|
|
345
346
|
was once declined. It parses as a join with no condition, exactly like
|
|
346
347
|
<code>CROSS JOIN</code> does, and rebuilding it through the join keyword would emit
|
|
@@ -198,14 +198,17 @@ not rewrite your SQL for you.</p>
|
|
|
198
198
|
<p>sqlalign needs <strong>Python 3.12 or newer</strong> and has exactly one runtime dependency:
|
|
199
199
|
<code>sqlglot</code>, pinned to the <code>30.14.x</code> line. (The layout engine reads exact AST
|
|
200
200
|
shapes, so the pin is deliberate — see the comment in <code>pyproject.toml</code>.)</p>
|
|
201
|
-
<pre><code class="language-sh">
|
|
201
|
+
<pre><code class="language-sh">pip install sqlalign
|
|
202
202
|
</code></pre>
|
|
203
203
|
<p>That installs a <code>sqlalign</code> command on your PATH. Check it:</p>
|
|
204
204
|
<pre><code class="language-sh">sqlalign --help
|
|
205
205
|
</code></pre>
|
|
206
|
-
<p>
|
|
207
|
-
|
|
208
|
-
<
|
|
206
|
+
<p><code>uv tool install sqlalign</code> does the same while keeping it out of your project's
|
|
207
|
+
environment.</p>
|
|
208
|
+
<p>For development on sqlalign itself, work from a clone instead — this adds the
|
|
209
|
+
dev tools (<code>pytest</code>, <code>ruff</code>, <code>sqlfluff</code>):</p>
|
|
210
|
+
<pre><code class="language-sh">git clone https://github.com/pua2/sqlalign && cd sqlalign
|
|
211
|
+
uv sync
|
|
209
212
|
</code></pre>
|
|
210
213
|
<h2 id="your-first-format">Your first format<a class="anchor" href="#your-first-format" aria-label="Link to this section">#</a></h2>
|
|
211
214
|
<p>Save this as <code>revenue.sql</code>:</p>
|
|
@@ -565,10 +568,10 @@ for <code>sqlalign --check $files</code> and drop the <code>git add</code>.</p>
|
|
|
565
568
|
which is exactly what a CI runner treats as a failure:</p>
|
|
566
569
|
<pre><code class="language-sh">sqlalign --check .
|
|
567
570
|
</code></pre>
|
|
568
|
-
<p>Wrapped in a job step
|
|
571
|
+
<p>Wrapped in a job step:</p>
|
|
569
572
|
<pre><code class="language-yaml">- name: Check SQL formatting
|
|
570
573
|
run: |
|
|
571
|
-
|
|
574
|
+
pip install sqlalign
|
|
572
575
|
sqlalign --check .
|
|
573
576
|
</code></pre>
|
|
574
577
|
<p>Use <code>--diff</code> instead of <code>--check</code> if you want the log to show what is wrong
|