sqlalign 1.1.0__tar.gz → 1.2.0__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.1.0 → sqlalign-1.2.0}/CHANGELOG.md +54 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/PKG-INFO +1 -1
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/guide/cli.md +2 -2
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/guide/dialects.md +18 -1
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/guide/faq.md +22 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/guide/getting-started.md +4 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/v1/architecture.html +1 -1
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/v1/cli.html +4 -4
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/v1/configuration.html +1 -1
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/v1/dialects.html +14 -2
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/v1/faq.html +21 -2
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/v1/getting-started.html +4 -1
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/v1/index.html +1 -1
- sqlalign-1.2.0/docs/v1/search-index.json +1 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/v1/settings.html +1 -1
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/v1/style.html +1 -1
- {sqlalign-1.1.0 → sqlalign-1.2.0}/pyproject.toml +1 -1
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/cli.py +40 -7
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/configfile.py +27 -4
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/formatter.py +58 -2
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/ddl.py +22 -1
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/grouporder.py +28 -3
- sqlalign-1.2.0/src/sqlalign/spelling.py +110 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_construct_sweep.py +4 -1
- sqlalign-1.2.0/tests/test_dialect_config.py +129 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_fetch_and_lateral_subquery.py +2 -2
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_packaging.py +10 -5
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_positioning.py +17 -0
- sqlalign-1.2.0/tests/test_rewrite_guard.py +96 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_tsql.py +26 -1
- {sqlalign-1.1.0 → sqlalign-1.2.0}/uv.lock +1 -1
- sqlalign-1.1.0/docs/v1/search-index.json +0 -1
- {sqlalign-1.1.0 → sqlalign-1.2.0}/.github/workflows/ci.yml +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/.github/workflows/release.yml +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/.gitignore +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/.pre-commit-hooks.yaml +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/.sqlfluff +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/CONTRIBUTING.md +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/LICENSE +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/README.md +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/action.yml +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/guide/README.md +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/guide/architecture.md +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/guide/configuration.md +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/guide/style.md +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/docs/index.html +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/samples/queries.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/scripts/build_fixtures.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/__init__.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/align.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/bodylint.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/casing.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/commas.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/config.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/gui.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/ir.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/keywordcase.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/__init__.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/case.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/comments.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/conditions.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/cte.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/dml.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/expr.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/fromjoin.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/select.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/setop.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/subquery.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/layout/window.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/lint.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/plpgsql.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/py.typed +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/splitter.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/sqlfluffconfig.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/style.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/src/sqlalign/templating.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/conftest.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/README.md +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__math__log_natural.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__math__median.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__math__percentile_cont.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__math__rand.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__regex__regexp_instr.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests___generalized___ignore_row_if_expression.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests___generalized___truth_expression.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests___generalized__equal_expression.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests___generalized__expression_between.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests___generalized__expression_is_true.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_count_to_be_greater_than.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_count_to_be_less_than.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_count_to_equal.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_count_to_equal_other_table.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_values_to_be_in_set.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_values_to_contain_set.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_values_to_equal_set.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_max_to_be_between.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_mean_to_be_between.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_median_to_be_between.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_min_to_be_between.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_most_common_value_to_be_in_set.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_proportion_of_unique_values_to_be_between.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_quantile_values_to_be_between.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_stdev_to_be_between.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_sum_to_be_between.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_unique_value_count_to_be_between.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_between.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_decreasing.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_in_set.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_in_type_list.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_increasing.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_null.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_of_type.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_unique.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_have_consistent_casing.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_not_be_in_set.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_not_be_null.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__distributional__expect_column_values_to_be_within_n_moving_stdevs.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/dbt-expectations/macros__schema_tests__distributional__expect_column_values_to_be_within_n_stdevs.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/jaffle-shop/models__customers.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/jaffle-shop/models__orders.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/jaffle-shop/models__staging__stg_customers.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/jaffle-shop/models__staging__stg_orders.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/jaffle-shop/models__staging__stg_payments.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/sqlglot/tests__fixtures__identity.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/sqlglot/tests__fixtures__optimizer__optimizer.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/corpus/sqlglot/tests__fixtures__pretty.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/docs/dbt.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/docs/fromblock.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/docs/hero.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/docs/plpgsql.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/01.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/02.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/03.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/04.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/05.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/06.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/07.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/08.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/09.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/10.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/11.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/12.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/13.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/14.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/15.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/16.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/17.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/18.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/19.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/20.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/21.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/22.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/23.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/24.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/25.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/26.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/27.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/28.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/expected/29.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/01.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/02.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/03.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/04.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/05.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/06.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/07.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/08.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/09.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/10.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/11.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/12.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/13.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/14.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/15.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/16.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/17.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/18.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/19.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/20.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/21.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/22.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/23.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/24.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/25.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/26.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/27.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/28.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/fixtures/input/29.sql +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_align.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_align_off.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_align_targets.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_ast_equiv.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_atomic_writes.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_axis_matrix.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_benchmark_tool.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_blank_lines.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_body_comments.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_bodylint.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_boolean_position.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_casing.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_clause_order.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_clauses.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_cli.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_comma_joins_lateral_udf.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_comma_position.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_comment_and_procedure_bugs.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_comment_safety.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_comments.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_comments_in_predicates.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_configfile.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_corpus.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_coverage_round_2.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_ddl.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_dialect_guard.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_distinct.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_dml.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_docs_examples.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_docs_site.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_expr.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_file_selection.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_fromjoin.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_golden.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_gui.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_init_config.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_keyword_case.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_knob_combinations.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_line_endings.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_lint_flag.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_negated_is_null.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_nested_constructs.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_no_silent_declines.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_on_placement.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_pivot.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_plpgsql.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_presets.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_quoted_column_aliases.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_remaining_constructs.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_report.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_report_growth_and_policy.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_river.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_robustness.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_safety.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_select_placement.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_skip.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_splitter.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_sqlfluff_coexistence.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_sqlfluff_gate.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_sqlglot_conformance.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_stdin_and_api.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_style_knobs.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_subquery.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_table_alias.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_table_names.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_templating.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_trailing_punctuation.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_unaliased_tables.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_upstream_and_tail.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_values_and_joins.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tests/test_width_off_and_body_blanks.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tools/benchmark.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tools/build_docs.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tools/docs.css +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tools/docs.js +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tools/docs_settings.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tools/fetch_corpus.py +0 -0
- {sqlalign-1.1.0 → sqlalign-1.2.0}/tools/shots.py +0 -0
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### sqlalign no longer respells your statements silently
|
|
6
|
+
|
|
7
|
+
The safety net compares output against input as a syntax tree, under the same
|
|
8
|
+
sqlglot. That is blind to a rewrite sqlglot's own parser performs: two spellings
|
|
9
|
+
collapse to one node, so printing either compares equal. Twenty statements went
|
|
10
|
+
through changed, with no decline and no warning -- `ADD COLUMN c INTEGER ARRAY`
|
|
11
|
+
came back as `INT`, `DROP FUNCTION f()` lost the signature that names the
|
|
12
|
+
overload, `WITH CSV HEADER FORCE QUOTE a, b` became three options where the
|
|
13
|
+
author wrote one, and T-SQL `SET (LOCK_ESCALATION = AUTO)` gained an invented
|
|
14
|
+
`WITH (...)` that SQL Server does not accept.
|
|
15
|
+
|
|
16
|
+
Each statement's tokens are now counted either side of formatting, and one that
|
|
17
|
+
gained or lost a token is passed through byte-identical instead. Nothing here is
|
|
18
|
+
a hand-kept list of allowed differences: type synonyms are derived by asking
|
|
19
|
+
sqlglot which spellings parse to the same node, so a new dialect or a renamed
|
|
20
|
+
type is followed rather than disagreed with, and the three settings that choose
|
|
21
|
+
a spelling are normalised away because choosing is their job.
|
|
22
|
+
|
|
23
|
+
Order is deliberately not compared. The tree already catches anything that
|
|
24
|
+
moved, so the two checks divide the space -- and comparing order here would
|
|
25
|
+
decline `GROUP BY ROLLUP(a, b), c` printed as `GROUP BY c, ROLLUP(a, b)`, which
|
|
26
|
+
is the same grouping sets.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **T-SQL paging emitted invalid SQL.** `OFFSET 10 ROWS` came back as
|
|
31
|
+
`OFFSET 10`, which SQL Server rejects. `Offset` records only the number, so
|
|
32
|
+
the AST check could not tell the spellings apart; the keyword is now emitted
|
|
33
|
+
where the dialect requires it, asked of sqlglot rather than hardcoded.
|
|
34
|
+
|
|
35
|
+
### `dialect` is a config key
|
|
36
|
+
|
|
37
|
+
```toml
|
|
38
|
+
# redshift-warehouse/.sqlalign.toml
|
|
39
|
+
dialect = "redshift"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Resolved per file from the config nearest it, so one command -- one editor
|
|
43
|
+
action, one pre-commit hook -- can span a Postgres repository and a Redshift one
|
|
44
|
+
and be right in both. `--dialect` still overrides for a one-off run.
|
|
45
|
+
|
|
46
|
+
This is not the auto-detection sqlalign refuses to do. Sniffing a file cannot be
|
|
47
|
+
covered by the safety guarantee; declaring the engine in a file your team
|
|
48
|
+
reviews is the opposite of a guess, and more explicit than a flag typed into an
|
|
49
|
+
editor's tool settings and never looked at again.
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- `CREATE OR ALTER VIEW` came back as `CREATE OR REPLACE VIEW` under T-SQL --
|
|
54
|
+
Postgres syntax written into a T-SQL file, which the AST check could not
|
|
55
|
+
reject because both spellings parse to the same `replace` flag.
|
|
56
|
+
|
|
3
57
|
## 1.1.0
|
|
4
58
|
|
|
5
59
|
### The guarantee now covers comments
|
|
@@ -117,11 +117,11 @@ else is an error unless you pass `--no-strict-config`.
|
|
|
117
117
|
|
|
118
118
|
`align` · `align_targets` · `blank_lines_between_statements` ·
|
|
119
119
|
`boolean_operator_position` · `clause_keyword_align` · `comma_position` ·
|
|
120
|
-
`decimal_style` · `exclude` · `format_dollar_bodies` · `keyword_case` ·
|
|
120
|
+
`decimal_style` · `dialect` · `exclude` · `format_dollar_bodies` · `keyword_case` ·
|
|
121
121
|
`neq_style` · `on_placement` · `preset` · `protect_templating` · `river_gutter` ·
|
|
122
122
|
`select_indent` · `select_placement` · `table_alias_style` · `width`
|
|
123
123
|
|
|
124
|
-
`--
|
|
124
|
+
`--line-ending` is the only setting with no config key. Three
|
|
125
125
|
of the four `--no-*` flags map onto the positive keys: `--no-align` is
|
|
126
126
|
`align = false`, `--no-protect-templating` is `protect_templating = false`, and
|
|
127
127
|
`--no-format-bodies` is `format_dollar_bodies = false`. The fourth,
|
|
@@ -30,7 +30,24 @@ directory with the right flag, or use `--exclude` to split the run.
|
|
|
30
30
|
**There is no dialect auto-detection.** sqlalign will not sniff your file, and
|
|
31
31
|
naming the wrong dialect is not covered by the safety guarantee — that guarantee
|
|
32
32
|
is scoped to the dialect you asked for, and the layout handlers emit *that*
|
|
33
|
-
dialect's keywords.
|
|
33
|
+
dialect's keywords. Name the engine the file will run on.
|
|
34
|
+
|
|
35
|
+
**Declare it once, in the config.** Guessing and declaring are different acts:
|
|
36
|
+
|
|
37
|
+
```toml
|
|
38
|
+
# redshift-warehouse/.sqlalign.toml
|
|
39
|
+
dialect = "redshift"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The dialect is then resolved per file, from the config nearest it — so one
|
|
43
|
+
command, one editor action or one pre-commit hook can span a Postgres repository
|
|
44
|
+
and a Redshift one and be right in both, without anyone choosing correctly each
|
|
45
|
+
time. `--dialect` still overrides it for a one-off run, and an unknown value is
|
|
46
|
+
refused rather than attempted, exactly as the flag is.
|
|
47
|
+
|
|
48
|
+
That is not sniffing. It is the author naming the engine in a file their team
|
|
49
|
+
reviews, which is more explicit than a flag typed into an editor's tool settings
|
|
50
|
+
and never looked at again.
|
|
34
51
|
|
|
35
52
|
**A dialect outside the three is refused, not attempted.** The CLI rejects the
|
|
36
53
|
argument outright:
|
|
@@ -56,9 +56,31 @@ The declines you are most likely to meet in ordinary Postgres SQL:
|
|
|
56
56
|
| Cursors, `FOR` loops, `EXCEPTION` blocks in a `$$` body | declines per statement inside the body, so the rest of the procedure still formats |
|
|
57
57
|
| T-SQL `IF`/`WHILE` inside a procedure body | sqlglot leaves part of the body unparsed, so there is no tree to lay out — see [Dialects](dialects.md) |
|
|
58
58
|
| A comment buried inside an expression, or in a positional `GROUP BY 1, 2` | the whole statement passes through rather than the comment being moved or restyled. Every clause that gets one row per term — the select list, `FROM`, `WHERE`/`HAVING`/`QUALIFY`, `GROUP BY`, `ORDER BY` — is modelled |
|
|
59
|
+
| Single-line DDL with a spelling sqlglot does not keep — `ALTER COLUMN x TYPE t`, `DROP FUNCTION f()`, `COPY … WITH CSV HEADER` | reported as `would respell this statement`; see below |
|
|
59
60
|
|
|
60
61
|
Per-dialect decline lists are on the [Dialects](dialects.md) page.
|
|
61
62
|
|
|
63
|
+
### Why "would respell this statement"?
|
|
64
|
+
|
|
65
|
+
Because formatting it would hand back SQL you did not write.
|
|
66
|
+
|
|
67
|
+
sqlglot's parser collapses some spellings before sqlalign ever sees them.
|
|
68
|
+
`ALTER COLUMN x TYPE text` and `ALTER COLUMN x SET DATA TYPE text` are one node,
|
|
69
|
+
so the information about which you wrote is gone, and printing either one back
|
|
70
|
+
compares equal to the tree check. The same happens to `DROP FUNCTION f()`, whose
|
|
71
|
+
empty argument list names the overload, and to `COPY … WITH CSV HEADER FORCE
|
|
72
|
+
QUOTE a, b`, where one option comes back as three.
|
|
73
|
+
|
|
74
|
+
sqlalign cannot preserve what it was never given, so it declines: your statement
|
|
75
|
+
is passed through byte-identical, exactly as any other decline. Before 1.2 these
|
|
76
|
+
were rewritten silently, which was the worse of the two.
|
|
77
|
+
|
|
78
|
+
The check counts the tokens either side of formatting and fires when one is
|
|
79
|
+
gained or lost. Order is not compared — the tree check already covers anything
|
|
80
|
+
that moved — and the spellings sqlalign's own settings choose between
|
|
81
|
+
(`!=`/`<>`, `DECIMAL`/`NUMERIC`, an optional `AS`, type synonyms like
|
|
82
|
+
`INT`/`INTEGER`) are normalised away, so an ordinary reformat never trips it.
|
|
83
|
+
|
|
62
84
|
## Why won't it fix my SQL?
|
|
63
85
|
|
|
64
86
|
Because it is not a linter, and it is built so that it structurally cannot be
|
|
@@ -488,6 +488,10 @@ formatter route does not.
|
|
|
488
488
|
plugin rather than looking for a marketplace listing — Settings → Tools → File
|
|
489
489
|
Watchers → `+` → `<custom>`:
|
|
490
490
|
|
|
491
|
+
If your projects target different engines, put `dialect = "redshift"` (or
|
|
492
|
+
`postgres`, `tsql`) in each one's `.sqlalign.toml` — the watcher then needs no
|
|
493
|
+
`--dialect` and is right in every project.
|
|
494
|
+
|
|
491
495
|
| Field | Value |
|
|
492
496
|
|---|---|
|
|
493
497
|
| File type | SQL |
|
|
@@ -167,7 +167,7 @@ dl.meta dd { margin:0; }
|
|
|
167
167
|
<a class="skip" href="#main">Skip to content</a>
|
|
168
168
|
<header class="top">
|
|
169
169
|
<a class="brand" href="../index.html">sqlalign</a>
|
|
170
|
-
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.
|
|
170
|
+
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.2 (current)</option></select>
|
|
171
171
|
<div class="search">
|
|
172
172
|
<input id="q" type="search" placeholder="Search docs…" autocomplete="off"
|
|
173
173
|
aria-label="Search documentation">
|
|
@@ -167,7 +167,7 @@ dl.meta dd { margin:0; }
|
|
|
167
167
|
<a class="skip" href="#main">Skip to content</a>
|
|
168
168
|
<header class="top">
|
|
169
169
|
<a class="brand" href="../index.html">sqlalign</a>
|
|
170
|
-
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.
|
|
170
|
+
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.2 (current)</option></select>
|
|
171
171
|
<div class="search">
|
|
172
172
|
<input id="q" type="search" placeholder="Search docs…" autocomplete="off"
|
|
173
173
|
aria-label="Search documentation">
|
|
@@ -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>--init</code></td><td>write a commented .sqlalign.toml in the current directory and exit; every setting is commented out, so the file changes nothing until you edit it</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, case_results, column_aliases, column_constraints, column_types, join_conditions, operators, table_aliases, table_names</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. Overrides a <code>dialect</code> in the config file (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>--init</code></td><td>write a commented .sqlalign.toml in the current directory and exit; every setting is commented out, so the file changes nothing until you edit it</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, case_results, column_aliases, column_constraints, column_types, join_conditions, operators, table_aliases, table_names</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
|
|
@@ -357,10 +357,10 @@ protect_templating = true
|
|
|
357
357
|
else is an error unless you pass <code>--no-strict-config</code>.</p>
|
|
358
358
|
<p><code>align</code> · <code>align_targets</code> · <code>blank_lines_between_statements</code> ·
|
|
359
359
|
<code>boolean_operator_position</code> · <code>clause_keyword_align</code> · <code>comma_position</code> ·
|
|
360
|
-
<code>decimal_style</code> · <code>exclude</code> · <code>format_dollar_bodies</code> · <code>keyword_case</code> ·
|
|
360
|
+
<code>decimal_style</code> · <code>dialect</code> · <code>exclude</code> · <code>format_dollar_bodies</code> · <code>keyword_case</code> ·
|
|
361
361
|
<code>neq_style</code> · <code>on_placement</code> · <code>preset</code> · <code>protect_templating</code> · <code>river_gutter</code> ·
|
|
362
362
|
<code>select_indent</code> · <code>select_placement</code> · <code>table_alias_style</code> · <code>width</code></p>
|
|
363
|
-
<p><code>--
|
|
363
|
+
<p><code>--line-ending</code> is the only setting with no config key. Three
|
|
364
364
|
of the four <code>--no-*</code> flags map onto the positive keys: <code>--no-align</code> is
|
|
365
365
|
<code>align = false</code>, <code>--no-protect-templating</code> is <code>protect_templating = false</code>, and
|
|
366
366
|
<code>--no-format-bodies</code> is <code>format_dollar_bodies = false</code>. The fourth,
|
|
@@ -167,7 +167,7 @@ dl.meta dd { margin:0; }
|
|
|
167
167
|
<a class="skip" href="#main">Skip to content</a>
|
|
168
168
|
<header class="top">
|
|
169
169
|
<a class="brand" href="../index.html">sqlalign</a>
|
|
170
|
-
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.
|
|
170
|
+
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.2 (current)</option></select>
|
|
171
171
|
<div class="search">
|
|
172
172
|
<input id="q" type="search" placeholder="Search docs…" autocomplete="off"
|
|
173
173
|
aria-label="Search documentation">
|
|
@@ -167,7 +167,7 @@ dl.meta dd { margin:0; }
|
|
|
167
167
|
<a class="skip" href="#main">Skip to content</a>
|
|
168
168
|
<header class="top">
|
|
169
169
|
<a class="brand" href="../index.html">sqlalign</a>
|
|
170
|
-
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.
|
|
170
|
+
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.2 (current)</option></select>
|
|
171
171
|
<div class="search">
|
|
172
172
|
<input id="q" type="search" placeholder="Search docs…" autocomplete="off"
|
|
173
173
|
aria-label="Search documentation">
|
|
@@ -229,7 +229,19 @@ directory with the right flag, or use <code>--exclude</code> to split the run.</
|
|
|
229
229
|
<p><strong>There is no dialect auto-detection.</strong> sqlalign will not sniff your file, and
|
|
230
230
|
naming the wrong dialect is not covered by the safety guarantee — that guarantee
|
|
231
231
|
is scoped to the dialect you asked for, and the layout handlers emit <em>that</em>
|
|
232
|
-
dialect's keywords.
|
|
232
|
+
dialect's keywords. Name the engine the file will run on.</p>
|
|
233
|
+
<p><strong>Declare it once, in the config.</strong> Guessing and declaring are different acts:</p>
|
|
234
|
+
<pre><code class="language-toml"># redshift-warehouse/.sqlalign.toml
|
|
235
|
+
dialect = "redshift"
|
|
236
|
+
</code></pre>
|
|
237
|
+
<p>The dialect is then resolved per file, from the config nearest it — so one
|
|
238
|
+
command, one editor action or one pre-commit hook can span a Postgres repository
|
|
239
|
+
and a Redshift one and be right in both, without anyone choosing correctly each
|
|
240
|
+
time. <code>--dialect</code> still overrides it for a one-off run, and an unknown value is
|
|
241
|
+
refused rather than attempted, exactly as the flag is.</p>
|
|
242
|
+
<p>That is not sniffing. It is the author naming the engine in a file their team
|
|
243
|
+
reviews, which is more explicit than a flag typed into an editor's tool settings
|
|
244
|
+
and never looked at again.</p>
|
|
233
245
|
<p><strong>A dialect outside the three is refused, not attempted.</strong> The CLI rejects the
|
|
234
246
|
argument outright:</p>
|
|
235
247
|
<pre><code class="language-console">$ sqlalign --dialect mysql q.sql
|
|
@@ -167,7 +167,7 @@ dl.meta dd { margin:0; }
|
|
|
167
167
|
<a class="skip" href="#main">Skip to content</a>
|
|
168
168
|
<header class="top">
|
|
169
169
|
<a class="brand" href="../index.html">sqlalign</a>
|
|
170
|
-
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.
|
|
170
|
+
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.2 (current)</option></select>
|
|
171
171
|
<div class="search">
|
|
172
172
|
<input id="q" type="search" placeholder="Search docs…" autocomplete="off"
|
|
173
173
|
aria-label="Search documentation">
|
|
@@ -275,9 +275,28 @@ passes through until the quote is fixed.</p>
|
|
|
275
275
|
<td>A comment buried inside an expression, or in a positional <code>GROUP BY 1, 2</code></td>
|
|
276
276
|
<td>the whole statement passes through rather than the comment being moved or restyled. Every clause that gets one row per term — the select list, <code>FROM</code>, <code>WHERE</code>/<code>HAVING</code>/<code>QUALIFY</code>, <code>GROUP BY</code>, <code>ORDER BY</code> — is modelled</td>
|
|
277
277
|
</tr>
|
|
278
|
+
<tr>
|
|
279
|
+
<td>Single-line DDL with a spelling sqlglot does not keep — <code>ALTER COLUMN x TYPE t</code>, <code>DROP FUNCTION f()</code>, <code>COPY … WITH CSV HEADER</code></td>
|
|
280
|
+
<td>reported as <code>would respell this statement</code>; see below</td>
|
|
281
|
+
</tr>
|
|
278
282
|
</tbody>
|
|
279
283
|
</table>
|
|
280
284
|
<p>Per-dialect decline lists are on the <a href="dialects.html">Dialects</a> page.</p>
|
|
285
|
+
<h3 id="why-quot-would-respell-this-statement-quot">Why "would respell this statement"?<a class="anchor" href="#why-quot-would-respell-this-statement-quot" aria-label="Link to this section">#</a></h3>
|
|
286
|
+
<p>Because formatting it would hand back SQL you did not write.</p>
|
|
287
|
+
<p>sqlglot's parser collapses some spellings before sqlalign ever sees them.
|
|
288
|
+
<code>ALTER COLUMN x TYPE text</code> and <code>ALTER COLUMN x SET DATA TYPE text</code> are one node,
|
|
289
|
+
so the information about which you wrote is gone, and printing either one back
|
|
290
|
+
compares equal to the tree check. The same happens to <code>DROP FUNCTION f()</code>, whose
|
|
291
|
+
empty argument list names the overload, and to <code>COPY … WITH CSV HEADER FORCE QUOTE a, b</code>, where one option comes back as three.</p>
|
|
292
|
+
<p>sqlalign cannot preserve what it was never given, so it declines: your statement
|
|
293
|
+
is passed through byte-identical, exactly as any other decline. Before 1.2 these
|
|
294
|
+
were rewritten silently, which was the worse of the two.</p>
|
|
295
|
+
<p>The check counts the tokens either side of formatting and fires when one is
|
|
296
|
+
gained or lost. Order is not compared — the tree check already covers anything
|
|
297
|
+
that moved — and the spellings sqlalign's own settings choose between
|
|
298
|
+
(<code>!=</code>/<code><></code>, <code>DECIMAL</code>/<code>NUMERIC</code>, an optional <code>AS</code>, type synonyms like
|
|
299
|
+
<code>INT</code>/<code>INTEGER</code>) are normalised away, so an ordinary reformat never trips it.</p>
|
|
281
300
|
<h2 id="why-won-t-it-fix-my-sql">Why won't it fix my SQL?<a class="anchor" href="#why-won-t-it-fix-my-sql" aria-label="Link to this section">#</a></h2>
|
|
282
301
|
<p>Because it is not a linter, and it is built so that it structurally cannot be
|
|
283
302
|
one. sqlalign will not:</p>
|
|
@@ -630,7 +649,7 @@ would change.</p>
|
|
|
630
649
|
<li><a href="architecture.html">Architecture</a> — the safety model and decline contract in full</li>
|
|
631
650
|
</ul>
|
|
632
651
|
</main>
|
|
633
|
-
<aside class="toc" aria-label="On this page"><p class="side-h">On this page</p><a class="lvl2" href="#why-did-my-statement-not-get-formatted">Why did my statement not get formatted?</a><a class="lvl2" href="#why-won-t-it-fix-my-sql">Why won't it fix my SQL?</a><a class="lvl2" href="#how-do-i-run-it-alongside-sqlfluff">How do I run it alongside sqlfluff?</a><a class="lvl2" href="#how-do-i-make-sqlalign-leave-one-statement-alone">How do I make sqlalign leave one statement alone?</a><a class="lvl2" href="#does-it-work-on-windows-with-crlf-files">Does it work on Windows / with CRLF files?</a><a class="lvl2" href="#does-it-handle-dbt-and-jinja">Does it handle dbt and Jinja?</a><a class="lvl2" href="#is-it-safe-to-run-on-my-whole-repo">Is it safe to run on my whole repo?</a><a class="lvl2" href="#how-fast-is-it">How fast is it?</a><a class="lvl2" href="#what-is-this-warning-that-doesn-t-say-sqlalign">What is this warning that doesn't say sqlalign:?</a><a class="lvl2" href="#why-did-the-exit-code-come-back-non-zero">Why did the exit code come back non-zero?</a><a class="lvl2" href="#see-also">See also</a></aside>
|
|
652
|
+
<aside class="toc" aria-label="On this page"><p class="side-h">On this page</p><a class="lvl2" href="#why-did-my-statement-not-get-formatted">Why did my statement not get formatted?</a><a class="lvl3" href="#why-quot-would-respell-this-statement-quot">Why &quot;would respell this statement&quot;?</a><a class="lvl2" href="#why-won-t-it-fix-my-sql">Why won't it fix my SQL?</a><a class="lvl2" href="#how-do-i-run-it-alongside-sqlfluff">How do I run it alongside sqlfluff?</a><a class="lvl2" href="#how-do-i-make-sqlalign-leave-one-statement-alone">How do I make sqlalign leave one statement alone?</a><a class="lvl2" href="#does-it-work-on-windows-with-crlf-files">Does it work on Windows / with CRLF files?</a><a class="lvl2" href="#does-it-handle-dbt-and-jinja">Does it handle dbt and Jinja?</a><a class="lvl2" href="#is-it-safe-to-run-on-my-whole-repo">Is it safe to run on my whole repo?</a><a class="lvl2" href="#how-fast-is-it">How fast is it?</a><a class="lvl2" href="#what-is-this-warning-that-doesn-t-say-sqlalign">What is this warning that doesn't say sqlalign:?</a><a class="lvl2" href="#why-did-the-exit-code-come-back-non-zero">Why did the exit code come back non-zero?</a><a class="lvl2" href="#see-also">See also</a></aside>
|
|
634
653
|
</div>
|
|
635
654
|
<script>// Docs chrome: theme toggle, version selector, on-this-page highlighting, and
|
|
636
655
|
// search over the generated index. No dependencies -- the site is static files
|
|
@@ -167,7 +167,7 @@ dl.meta dd { margin:0; }
|
|
|
167
167
|
<a class="skip" href="#main">Skip to content</a>
|
|
168
168
|
<header class="top">
|
|
169
169
|
<a class="brand" href="../index.html">sqlalign</a>
|
|
170
|
-
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.
|
|
170
|
+
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.2 (current)</option></select>
|
|
171
171
|
<div class="search">
|
|
172
172
|
<input id="q" type="search" placeholder="Search docs…" autocomplete="off"
|
|
173
173
|
aria-label="Search documentation">
|
|
@@ -569,6 +569,9 @@ formatter route does not.</p>
|
|
|
569
569
|
<p><strong>JetBrains (DataGrip, PyCharm, IntelliJ).</strong> Use the bundled <strong>File Watchers</strong>
|
|
570
570
|
plugin rather than looking for a marketplace listing — Settings → Tools → File
|
|
571
571
|
Watchers → <code>+</code> → <code><custom></code>:</p>
|
|
572
|
+
<p>If your projects target different engines, put <code>dialect = "redshift"</code> (or
|
|
573
|
+
<code>postgres</code>, <code>tsql</code>) in each one's <code>.sqlalign.toml</code> — the watcher then needs no
|
|
574
|
+
<code>--dialect</code> and is right in every project.</p>
|
|
572
575
|
<table>
|
|
573
576
|
<thead>
|
|
574
577
|
<tr>
|
|
@@ -167,7 +167,7 @@ dl.meta dd { margin:0; }
|
|
|
167
167
|
<a class="skip" href="#main">Skip to content</a>
|
|
168
168
|
<header class="top">
|
|
169
169
|
<a class="brand" href="../index.html">sqlalign</a>
|
|
170
|
-
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.
|
|
170
|
+
<select class="version" aria-label="Documentation version"><option value="v1" selected>1.2 (current)</option></select>
|
|
171
171
|
<div class="search">
|
|
172
172
|
<input id="q" type="search" placeholder="Search docs…" autocomplete="off"
|
|
173
173
|
aria-label="Search documentation">
|