sqlalign 1.0.2__tar.gz → 1.1.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.
Files changed (270) hide show
  1. sqlalign-1.1.0/.github/workflows/ci.yml +168 -0
  2. sqlalign-1.1.0/.gitignore +10 -0
  3. sqlalign-1.1.0/.pre-commit-hooks.yaml +25 -0
  4. {sqlalign-1.0.2 → sqlalign-1.1.0}/CHANGELOG.md +82 -0
  5. {sqlalign-1.0.2 → sqlalign-1.1.0}/CONTRIBUTING.md +13 -5
  6. {sqlalign-1.0.2 → sqlalign-1.1.0}/PKG-INFO +88 -21
  7. {sqlalign-1.0.2 → sqlalign-1.1.0}/README.md +82 -18
  8. sqlalign-1.1.0/action.yml +62 -0
  9. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/guide/architecture.md +27 -12
  10. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/guide/cli.md +19 -7
  11. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/guide/configuration.md +3 -3
  12. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/guide/faq.md +40 -16
  13. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/guide/getting-started.md +143 -24
  14. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/guide/style.md +43 -11
  15. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/v1/architecture.html +25 -13
  16. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/v1/cli.html +30 -9
  17. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/v1/configuration.html +5 -5
  18. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/v1/dialects.html +1 -1
  19. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/v1/faq.html +44 -19
  20. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/v1/getting-started.html +136 -24
  21. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/v1/index.html +1 -1
  22. sqlalign-1.1.0/docs/v1/search-index.json +1 -0
  23. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/v1/settings.html +1 -1
  24. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/v1/style.html +48 -13
  25. {sqlalign-1.0.2 → sqlalign-1.1.0}/pyproject.toml +38 -10
  26. sqlalign-1.1.0/src/sqlalign/__init__.py +90 -0
  27. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/cli.py +137 -14
  28. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/configfile.py +56 -2
  29. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/formatter.py +67 -6
  30. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/gui.py +83 -5
  31. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/keywordcase.py +8 -2
  32. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/__init__.py +19 -0
  33. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/conditions.py +50 -3
  34. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/cte.py +7 -2
  35. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/plpgsql.py +60 -5
  36. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/style.py +26 -0
  37. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/conftest.py +12 -0
  38. sqlalign-1.1.0/tests/corpus/README.md +38 -0
  39. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__math__log_natural.sql +27 -0
  40. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__math__median.sql +3 -0
  41. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__math__percentile_cont.sql +18 -0
  42. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__math__rand.sql +39 -0
  43. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__regex__regexp_instr.sql +112 -0
  44. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests___generalized___ignore_row_if_expression.sql +20 -0
  45. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests___generalized___truth_expression.sql +8 -0
  46. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests___generalized__equal_expression.sql +110 -0
  47. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests___generalized__expression_between.sql +44 -0
  48. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests___generalized__expression_is_true.sql +58 -0
  49. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_count_to_be_greater_than.sql +15 -0
  50. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_count_to_be_less_than.sql +15 -0
  51. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_count_to_equal.sql +15 -0
  52. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_count_to_equal_other_table.sql +26 -0
  53. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_values_to_be_in_set.sql +55 -0
  54. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_values_to_contain_set.sql +54 -0
  55. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_values_to_equal_set.sql +55 -0
  56. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_max_to_be_between.sql +19 -0
  57. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_mean_to_be_between.sql +19 -0
  58. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_median_to_be_between.sql +20 -0
  59. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_min_to_be_between.sql +20 -0
  60. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_most_common_value_to_be_in_set.sql +100 -0
  61. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_proportion_of_unique_values_to_be_between.sql +20 -0
  62. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_quantile_values_to_be_between.sql +21 -0
  63. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_stdev_to_be_between.sql +38 -0
  64. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_sum_to_be_between.sql +19 -0
  65. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_unique_value_count_to_be_between.sql +19 -0
  66. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_between.sql +22 -0
  67. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_decreasing.sql +58 -0
  68. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_in_set.sql +46 -0
  69. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_in_type_list.sql +32 -0
  70. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_increasing.sql +60 -0
  71. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_null.sql +11 -0
  72. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_of_type.sql +4 -0
  73. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_unique.sql +3 -0
  74. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_have_consistent_casing.sql +41 -0
  75. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_not_be_in_set.sql +44 -0
  76. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_not_be_null.sql +11 -0
  77. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__distributional__expect_column_values_to_be_within_n_moving_stdevs.sql +152 -0
  78. sqlalign-1.1.0/tests/corpus/dbt-expectations/macros__schema_tests__distributional__expect_column_values_to_be_within_n_stdevs.sql +57 -0
  79. sqlalign-1.1.0/tests/corpus/jaffle-shop/models__customers.sql +69 -0
  80. sqlalign-1.1.0/tests/corpus/jaffle-shop/models__orders.sql +56 -0
  81. sqlalign-1.1.0/tests/corpus/jaffle-shop/models__staging__stg_customers.sql +22 -0
  82. sqlalign-1.1.0/tests/corpus/jaffle-shop/models__staging__stg_orders.sql +23 -0
  83. sqlalign-1.1.0/tests/corpus/jaffle-shop/models__staging__stg_payments.sql +25 -0
  84. sqlalign-1.1.0/tests/corpus/sqlglot/tests__fixtures__identity.sql +977 -0
  85. sqlalign-1.1.0/tests/corpus/sqlglot/tests__fixtures__optimizer__optimizer.sql +1592 -0
  86. sqlalign-1.1.0/tests/corpus/sqlglot/tests__fixtures__pretty.sql +524 -0
  87. sqlalign-1.1.0/tests/test_benchmark_tool.py +28 -0
  88. sqlalign-1.1.0/tests/test_body_comments.py +73 -0
  89. sqlalign-1.1.0/tests/test_comment_safety.py +118 -0
  90. sqlalign-1.1.0/tests/test_corpus.py +107 -0
  91. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_docs_site.py +35 -0
  92. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_gui.py +105 -2
  93. sqlalign-1.1.0/tests/test_init_config.py +127 -0
  94. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_keyword_case.py +28 -0
  95. sqlalign-1.1.0/tests/test_negated_is_null.py +104 -0
  96. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_no_silent_declines.py +12 -1
  97. sqlalign-1.1.0/tests/test_packaging.py +181 -0
  98. sqlalign-1.1.0/tests/test_positioning.py +170 -0
  99. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_quoted_column_aliases.py +38 -0
  100. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_report.py +6 -1
  101. sqlalign-1.1.0/tests/test_report_growth_and_policy.py +84 -0
  102. sqlalign-1.1.0/tests/test_sqlglot_conformance.py +175 -0
  103. sqlalign-1.1.0/tests/test_stdin_and_api.py +236 -0
  104. sqlalign-1.1.0/tools/benchmark.py +87 -0
  105. {sqlalign-1.0.2 → sqlalign-1.1.0}/tools/build_docs.py +31 -2
  106. {sqlalign-1.0.2 → sqlalign-1.1.0}/tools/docs_settings.py +19 -19
  107. sqlalign-1.1.0/tools/fetch_corpus.py +146 -0
  108. {sqlalign-1.0.2 → sqlalign-1.1.0}/uv.lock +168 -3
  109. sqlalign-1.0.2/.github/workflows/ci.yml +0 -95
  110. sqlalign-1.0.2/.gitignore +0 -18
  111. sqlalign-1.0.2/docs/.nojekyll +0 -0
  112. sqlalign-1.0.2/docs/CNAME +0 -1
  113. sqlalign-1.0.2/docs/sql-style-guide.md +0 -569
  114. sqlalign-1.0.2/docs/v1/search-index.json +0 -1
  115. sqlalign-1.0.2/src/sqlalign/__init__.py +0 -10
  116. sqlalign-1.0.2/tests/test_packaging.py +0 -75
  117. {sqlalign-1.0.2 → sqlalign-1.1.0}/.github/workflows/release.yml +0 -0
  118. {sqlalign-1.0.2 → sqlalign-1.1.0}/.sqlfluff +0 -0
  119. {sqlalign-1.0.2 → sqlalign-1.1.0}/LICENSE +0 -0
  120. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/guide/README.md +0 -0
  121. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/guide/dialects.md +0 -0
  122. {sqlalign-1.0.2 → sqlalign-1.1.0}/docs/index.html +0 -0
  123. {sqlalign-1.0.2 → sqlalign-1.1.0}/samples/queries.sql +0 -0
  124. {sqlalign-1.0.2 → sqlalign-1.1.0}/scripts/build_fixtures.py +0 -0
  125. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/align.py +0 -0
  126. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/bodylint.py +0 -0
  127. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/casing.py +0 -0
  128. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/commas.py +0 -0
  129. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/config.py +0 -0
  130. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/ir.py +0 -0
  131. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/case.py +0 -0
  132. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/comments.py +0 -0
  133. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/ddl.py +0 -0
  134. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/dml.py +0 -0
  135. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/expr.py +0 -0
  136. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/fromjoin.py +0 -0
  137. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/grouporder.py +0 -0
  138. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/select.py +0 -0
  139. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/setop.py +0 -0
  140. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/subquery.py +0 -0
  141. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/layout/window.py +0 -0
  142. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/lint.py +0 -0
  143. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/py.typed +0 -0
  144. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/splitter.py +0 -0
  145. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/sqlfluffconfig.py +0 -0
  146. {sqlalign-1.0.2 → sqlalign-1.1.0}/src/sqlalign/templating.py +0 -0
  147. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/docs/dbt.sql +0 -0
  148. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/docs/fromblock.sql +0 -0
  149. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/docs/hero.sql +0 -0
  150. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/docs/plpgsql.sql +0 -0
  151. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/01.sql +0 -0
  152. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/02.sql +0 -0
  153. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/03.sql +0 -0
  154. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/04.sql +0 -0
  155. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/05.sql +0 -0
  156. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/06.sql +0 -0
  157. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/07.sql +0 -0
  158. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/08.sql +0 -0
  159. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/09.sql +0 -0
  160. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/10.sql +0 -0
  161. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/11.sql +0 -0
  162. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/12.sql +0 -0
  163. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/13.sql +0 -0
  164. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/14.sql +0 -0
  165. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/15.sql +0 -0
  166. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/16.sql +0 -0
  167. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/17.sql +0 -0
  168. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/18.sql +0 -0
  169. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/19.sql +0 -0
  170. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/20.sql +0 -0
  171. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/21.sql +0 -0
  172. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/22.sql +0 -0
  173. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/23.sql +0 -0
  174. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/24.sql +0 -0
  175. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/25.sql +0 -0
  176. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/26.sql +0 -0
  177. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/27.sql +0 -0
  178. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/28.sql +0 -0
  179. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/expected/29.sql +0 -0
  180. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/01.sql +0 -0
  181. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/02.sql +0 -0
  182. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/03.sql +0 -0
  183. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/04.sql +0 -0
  184. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/05.sql +0 -0
  185. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/06.sql +0 -0
  186. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/07.sql +0 -0
  187. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/08.sql +0 -0
  188. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/09.sql +0 -0
  189. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/10.sql +0 -0
  190. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/11.sql +0 -0
  191. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/12.sql +0 -0
  192. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/13.sql +0 -0
  193. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/14.sql +0 -0
  194. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/15.sql +0 -0
  195. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/16.sql +0 -0
  196. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/17.sql +0 -0
  197. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/18.sql +0 -0
  198. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/19.sql +0 -0
  199. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/20.sql +0 -0
  200. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/21.sql +0 -0
  201. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/22.sql +0 -0
  202. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/23.sql +0 -0
  203. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/24.sql +0 -0
  204. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/25.sql +0 -0
  205. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/26.sql +0 -0
  206. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/27.sql +0 -0
  207. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/28.sql +0 -0
  208. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/fixtures/input/29.sql +0 -0
  209. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_align.py +0 -0
  210. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_align_off.py +0 -0
  211. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_align_targets.py +0 -0
  212. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_ast_equiv.py +0 -0
  213. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_atomic_writes.py +0 -0
  214. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_axis_matrix.py +0 -0
  215. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_blank_lines.py +0 -0
  216. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_bodylint.py +0 -0
  217. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_boolean_position.py +0 -0
  218. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_casing.py +0 -0
  219. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_clause_order.py +0 -0
  220. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_clauses.py +0 -0
  221. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_cli.py +0 -0
  222. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_comma_joins_lateral_udf.py +0 -0
  223. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_comma_position.py +0 -0
  224. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_comment_and_procedure_bugs.py +0 -0
  225. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_comments.py +0 -0
  226. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_comments_in_predicates.py +0 -0
  227. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_configfile.py +0 -0
  228. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_construct_sweep.py +0 -0
  229. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_coverage_round_2.py +0 -0
  230. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_ddl.py +0 -0
  231. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_dialect_guard.py +0 -0
  232. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_distinct.py +0 -0
  233. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_dml.py +0 -0
  234. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_docs_examples.py +0 -0
  235. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_expr.py +0 -0
  236. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_fetch_and_lateral_subquery.py +0 -0
  237. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_file_selection.py +0 -0
  238. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_fromjoin.py +0 -0
  239. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_golden.py +0 -0
  240. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_knob_combinations.py +0 -0
  241. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_line_endings.py +0 -0
  242. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_lint_flag.py +0 -0
  243. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_nested_constructs.py +0 -0
  244. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_on_placement.py +0 -0
  245. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_pivot.py +0 -0
  246. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_plpgsql.py +0 -0
  247. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_presets.py +0 -0
  248. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_remaining_constructs.py +0 -0
  249. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_river.py +0 -0
  250. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_robustness.py +0 -0
  251. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_safety.py +0 -0
  252. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_select_placement.py +0 -0
  253. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_skip.py +0 -0
  254. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_splitter.py +0 -0
  255. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_sqlfluff_coexistence.py +0 -0
  256. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_sqlfluff_gate.py +0 -0
  257. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_style_knobs.py +0 -0
  258. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_subquery.py +0 -0
  259. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_table_alias.py +0 -0
  260. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_table_names.py +0 -0
  261. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_templating.py +0 -0
  262. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_trailing_punctuation.py +0 -0
  263. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_tsql.py +0 -0
  264. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_unaliased_tables.py +0 -0
  265. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_upstream_and_tail.py +0 -0
  266. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_values_and_joins.py +0 -0
  267. {sqlalign-1.0.2 → sqlalign-1.1.0}/tests/test_width_off_and_body_blanks.py +0 -0
  268. {sqlalign-1.0.2 → sqlalign-1.1.0}/tools/docs.css +0 -0
  269. {sqlalign-1.0.2 → sqlalign-1.1.0}/tools/docs.js +0 -0
  270. {sqlalign-1.0.2 → sqlalign-1.1.0}/tools/shots.py +0 -0
@@ -0,0 +1,168 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ # A new push supersedes the run in flight. Actions minutes are free for public
9
+ # repositories, but a queue of stale runs still delays the useful one.
10
+ concurrency:
11
+ group: ${{ github.workflow }}-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ test:
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ # Every version pyproject claims to support, because a classifier nobody
24
+ # runs is a guess. `test_the_python_classifiers_match_requires_python`
25
+ # compares this list against the classifiers, so the two cannot drift.
26
+ python: ["3.10", "3.11", "3.12", "3.13"]
27
+ # UV_PYTHON is what makes the matrix real: without it every leg resolves the
28
+ # same default interpreter, and four green jobs prove one version. That is
29
+ # not hypothetical -- it shipped, and "3.10 passes CI" was untrue for as
30
+ # long as nothing consumed the matrix value.
31
+ env:
32
+ UV_PYTHON: ${{ matrix.python }}
33
+ steps:
34
+ - uses: actions/checkout@v4
35
+
36
+ - uses: astral-sh/setup-uv@v5
37
+ with:
38
+ enable-cache: true
39
+
40
+ - name: Install
41
+ run: uv sync --locked --all-extras
42
+
43
+ # The job name says a version; this step makes it true. If UV_PYTHON stops
44
+ # being honoured, the leg fails here rather than testing the wrong thing.
45
+ - name: The interpreter is the matrix version
46
+ run: |
47
+ uv run python -c "
48
+ import os, sys
49
+ want = tuple(map(int, os.environ['UV_PYTHON'].split('.')))
50
+ assert sys.version_info[:2] == want, f'{sys.version} is not {want}'
51
+ print(sys.version)"
52
+
53
+ - name: Lint
54
+ run: uv run ruff check .
55
+
56
+ - name: Test
57
+ run: uv run pytest -q
58
+
59
+ # The formatter's own output is the product, so a golden that no longer
60
+ # matches is a release blocker rather than a test failure among others. This
61
+ # runs the same assertion the suite does, separately, so the reason a red
62
+ # build is red is visible from the job list.
63
+ goldens:
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
71
+ - name: Goldens are byte-exact
72
+ run: uv run pytest -q -k goldens_unchanged
73
+
74
+ # `--lint` supports a RANGE of sqlfluff, but the matrix above only ever runs
75
+ # the top of it. The rule names and config keys the coexistence config emits
76
+ # are versioned surface, and `version_warning` is deliberately silent for a
77
+ # sqlfluff older than the one the mappings were checked against -- so if the
78
+ # floor broke, a user on it would get a wrong config and no warning at all.
79
+ # Nothing but this job would notice.
80
+ sqlfluff-floor:
81
+ runs-on: ubuntu-latest
82
+ steps:
83
+ - uses: actions/checkout@v4
84
+ - uses: astral-sh/setup-uv@v5
85
+ with:
86
+ enable-cache: true
87
+ - run: uv sync --locked --all-extras
88
+
89
+ # The oldest release the `lint` extra allows. Pinned exactly: "the floor"
90
+ # is only meaningful if it is the floor that ran.
91
+ - name: Install the oldest supported sqlfluff
92
+ run: uv pip install 'sqlfluff==4.2.0'
93
+
94
+ - name: The coexistence config still holds
95
+ run: |
96
+ uv run --no-sync python -c "import sqlfluff; print(sqlfluff.__version__)"
97
+ uv run --no-sync pytest -q tests/test_sqlfluff_coexistence.py \
98
+ tests/test_lint_flag.py \
99
+ tests/test_bodylint.py
100
+
101
+ # `action.yml` is a published interface -- someone writes `uses: pua2/sqlalign@v1`
102
+ # and it either works or it does not. Nothing but running it proves the manifest
103
+ # parses, the inputs thread through, and a failing check actually fails the step.
104
+ action:
105
+ runs-on: ubuntu-latest
106
+ steps:
107
+ - uses: actions/checkout@v4
108
+
109
+ - name: One formatted file and one that is not
110
+ run: |
111
+ mkdir -p action-test
112
+ printf 'select a,b from t;\n' > action-test/messy.sql
113
+ printf 'SELECT a\n , b\nFROM t;\n' > action-test/tidy.sql
114
+
115
+ - name: Formatted SQL passes
116
+ uses: ./
117
+ with:
118
+ paths: action-test/tidy.sql
119
+
120
+ - name: Unformatted SQL fails
121
+ id: messy
122
+ continue-on-error: true
123
+ uses: ./
124
+ with:
125
+ paths: action-test/messy.sql
126
+
127
+ # `continue-on-error` above records the outcome instead of ending the job,
128
+ # so the failure can be asserted rather than merely survived.
129
+ - name: ...and that failure is the assertion
130
+ run: test "${{ steps.messy.outcome }}" = failure
131
+
132
+ # The matrix above runs whatever uv.lock pins, which is the OLDEST end of the
133
+ # sqlglot range in practice. The newest release the range allows is the one
134
+ # nothing else covers -- and it is the risky end, because the safety net cannot
135
+ # see an upstream shape change: ast_equal compares output to input under the
136
+ # same sqlglot, so both sides move together and the check stays green.
137
+ #
138
+ # This is the job that makes `>=30.14,<31` safe rather than hopeful. When it
139
+ # goes red, tests/test_sqlglot_conformance.py names the shape that moved.
140
+ sqlglot-newest:
141
+ runs-on: ubuntu-latest
142
+ steps:
143
+ - uses: actions/checkout@v4
144
+ - uses: astral-sh/setup-uv@v5
145
+ with:
146
+ enable-cache: true
147
+ - run: uv sync --locked --all-extras
148
+
149
+ - name: Install the newest sqlglot the range allows
150
+ run: uv pip install --upgrade 'sqlglot>=30.14,<31'
151
+
152
+ - name: The whole suite, not just the shape assertions
153
+ run: |
154
+ uv run --no-sync python -c "import sqlglot; print(sqlglot.__version__)"
155
+ uv run --no-sync pytest -q
156
+
157
+ # docs/v1 is generated and committed, so a stale build ships. Rebuilding here
158
+ # proves the committed site matches its generator.
159
+ docs:
160
+ runs-on: ubuntu-latest
161
+ steps:
162
+ - uses: actions/checkout@v4
163
+ - uses: astral-sh/setup-uv@v5
164
+ with:
165
+ enable-cache: true
166
+ - run: uv sync --locked
167
+ - name: Site matches its generator
168
+ run: uv run pytest -q tests/test_docs_site.py
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .pytest_cache/
4
+ .venv
5
+ .venv.nosync/
6
+ dist/
7
+ build/
8
+ *.egg-info/
9
+ # scratch scripts must not be committed
10
+ /probe_*.py
@@ -0,0 +1,25 @@
1
+ # Hooks for https://pre-commit.com. A consumer adds this repository to their
2
+ # .pre-commit-config.yaml and picks one:
3
+ #
4
+ # - repo: https://github.com/pua2/sqlalign
5
+ # rev: v1.1.0
6
+ # hooks:
7
+ # - id: sqlalign
8
+ #
9
+ # `sqlalign` rewrites and restages; `sqlalign-check` only reports. Both are the
10
+ # same binary -- the split exists because a team adopting the style wants the
11
+ # first, and a team gating a repository it does not own wants the second.
12
+
13
+ - id: sqlalign
14
+ name: sqlalign
15
+ description: Format SQL into the columnar house style, in place.
16
+ entry: sqlalign
17
+ language: python
18
+ types: [sql]
19
+
20
+ - id: sqlalign-check
21
+ name: sqlalign (check only)
22
+ description: Fail if any SQL file is not already formatted, and change nothing.
23
+ entry: sqlalign --check
24
+ language: python
25
+ types: [sql]
@@ -1,5 +1,87 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### The guarantee now covers comments
6
+
7
+ Every statement was already re-parsed and compared as a syntax tree. Comments are
8
+ not in that tree — sqlglot hangs them off tokens — so the check passed whether or
9
+ not a comment survived, and the two worst bugs in this project's history lived in
10
+ that gap and were semantic rather than cosmetic: `SELECT a -- c,` lost a
11
+ separator, and `SELECT a -- note;` left the statement unterminated so it swallowed
12
+ the next one.
13
+
14
+ Each statement is now also compared on the comments it carries, and one that
15
+ would differ is passed through byte-identical like any other. Text and order are
16
+ compared, not position: the layout deliberately moves a comment to the end of the
17
+ row above. Comments inside a `$$` body remain outside this check; those
18
+ statements are compared structurally instead.
19
+
20
+ ### Running it where you already work
21
+
22
+ - **pre-commit hooks and a GitHub Action.** `sqlalign` rewrites and fails so you
23
+ restage; `sqlalign-check` only reports. The action defaults to `--check`,
24
+ because an action that silently reformats a checkout is not what a gate is for.
25
+ - **`sqlalign -`** reads stdin and writes stdout, which is what an editor's
26
+ format-on-save runs. `--check` and `--diff` still report rather than write.
27
+ - **A Python API.** `sqlalign.format` returns the text; `sqlalign.format_result`
28
+ also returns what happened. Both exist because a statement sqlalign cannot
29
+ model comes back byte-identical rather than raising, so the simple function
30
+ cannot tell "formatted" from "left alone".
31
+ - **`sqlalign --init`** writes a starter `.sqlalign.toml`, every setting
32
+ commented out. A starter that pinned eighteen settings would freeze you on the
33
+ day's defaults and call it a decision.
34
+
35
+ ### Wider support
36
+
37
+ - **Python 3.10 and 3.11.** Nothing in the engine needed porting; `tomllib` gets
38
+ a shim below 3.11. CI runs all four versions, and a test compares the
39
+ classifiers, the `requires-python` floor and the CI matrix against each other.
40
+ - **sqlglot `>=30.14,<31`** rather than a single patch line. The range is safe
41
+ because `tests/test_sqlglot_conformance.py` asserts each AST shape the layout
42
+ reads, and CI runs the whole suite against the newest release the range allows.
43
+ The safety net cannot catch an upstream shape change on its own: it compares
44
+ output to input under the same sqlglot, so both sides move together.
45
+
46
+ ### Fixed
47
+
48
+ - **Comments inside a `$$` body were keyword-cased, with the terminator spliced
49
+ into the comment.** `-- log it for the user` shipped as
50
+ `-- LOG it FOR the user;` with no decline. A same-line trailing comment is now
51
+ reproduced verbatim; a comment position the body renderer does not model
52
+ declines instead of guessing — the same contract the SQL comment engine
53
+ follows, now held on both sides of the dollar quotes.
54
+ - **`--report` and `--max-declines` were blind to templated files.** The
55
+ Jinja/dbt path dropped the statement and decline counts, so most of a dbt
56
+ project was invisible to the coverage gate.
57
+ - **A quoted identifier immunised the keyword it was spelled as.**
58
+ `SELECT a AS "FROM"` under `keyword_case = "lower"` left the real `FROM`
59
+ upper in an otherwise lowercase file.
60
+ - **`sqlalign - | head` dumped a traceback.** The command now exits `141`, the
61
+ shell's spelling of death-by-SIGPIPE.
62
+ - `WITH "cte" AS (...)` declined. The CTE name printed from `.alias`, which
63
+ strips quoting, so the output named a different relation. Machine-generated SQL
64
+ quotes every identifier, so this affected a whole class of input.
65
+ - `WHERE NOT b IS NULL` declined under Postgres. The renderer rewrote it to
66
+ `b IS NOT NULL` — the same meaning, but not what was written. Whether the two
67
+ spellings can be told apart is a property of the dialect, so it is now probed
68
+ rather than assumed.
69
+
70
+ Both were found by a new corpus suite that runs the formatter over third-party
71
+ SQL — sqlglot's own fixtures, dbt's example project, and a macro-heavy dbt
72
+ package — vendored at pinned commits.
73
+
74
+ ### Also
75
+
76
+ - `--report` names the construct declining most often and links a pre-filled
77
+ issue, so a coverage gap measured on your SQL has somewhere to go.
78
+ - The settings panel says why a control is greyed out, and the config it writes
79
+ records where it came from.
80
+ - A published benchmark (`tools/benchmark.py`): about 180 files/s, which is why
81
+ there is no `--jobs` flag.
82
+ - The style stability policy is written down: no style change in a patch release,
83
+ enforced by byte-exact goldens in their own CI job.
84
+
3
85
  ## 1.0.2
4
86
 
5
87
  ### Fixed
@@ -6,14 +6,22 @@ are not obvious from the code, and that will otherwise cost you an afternoon.
6
6
  ## Setup
7
7
 
8
8
  ```sh
9
- uv sync # Python 3.12+
10
- uv run pytest -q # ~3,300 tests, about 40 seconds
9
+ uv sync # Python 3.10+
10
+ uv run pytest -q # ~4,000 tests, about a minute
11
11
  uv run ruff check .
12
12
  ```
13
13
 
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.
14
+ Both must be clean before a pull request. CI runs the same two checks on Python
15
+ 3.10 through 3.13, and then five more jobs, each separate so a red build says
16
+ which thing broke:
17
+
18
+ | Job | What it protects |
19
+ |---|---|
20
+ | `goldens` | the style, byte for byte — this is what makes the stability policy true |
21
+ | `docs` | the committed site still matches its generator |
22
+ | `action` | `action.yml` is a published interface; nothing else runs it |
23
+ | `sqlfluff-floor` | the oldest sqlfluff the `lint` extra allows |
24
+ | `sqlglot-newest` | the newest sqlglot the range allows, which the lockfile never covers |
17
25
 
18
26
  ## The goldens are the specification
19
27
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sqlalign
3
- Version: 1.0.2
3
+ Version: 1.1.0
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/
@@ -14,6 +14,8 @@ Classifier: Development Status :: 5 - Production/Stable
14
14
  Classifier: Environment :: Console
15
15
  Classifier: Intended Audience :: Developers
16
16
  Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
17
19
  Classifier: Programming Language :: Python :: 3.12
18
20
  Classifier: Programming Language :: Python :: 3.13
19
21
  Classifier: Programming Language :: SQL
@@ -21,27 +23,36 @@ Classifier: Topic :: Database
21
23
  Classifier: Topic :: Software Development :: Quality Assurance
22
24
  Classifier: Topic :: Text Processing :: Filters
23
25
  Classifier: Typing :: Typed
24
- Requires-Python: >=3.12
25
- Requires-Dist: sqlglot<30.15,>=30.14
26
+ Requires-Python: >=3.10
27
+ Requires-Dist: sqlglot<31,>=30.14
28
+ Requires-Dist: tomli>=2; python_version < '3.11'
26
29
  Provides-Extra: lint
27
30
  Requires-Dist: sqlfluff<5,>=4.2; extra == 'lint'
28
31
  Description-Content-Type: text/markdown
29
32
 
30
33
  # sqlalign
31
34
 
32
- A SQL formatter for **Postgres**, **Redshift** and **SQL Server** that **cannot change what your
33
- SQL means**. Every statement it formats is re-parsed and AST-compared against the
34
- input; if the output would differ semantically — or if the engine doesn't fully
35
- model the construct — the statement is passed through **byte-identical** with a
36
- warning instead. It reformats presentation and nothing else: identifiers, string
37
- literals, cast form (`::` vs `CAST`), `GROUP BY` references, and alias choices all
38
- survive exactly as written.
35
+ A SQL formatter for **Postgres**, **Redshift** and **SQL Server** that **cannot
36
+ change what your SQL means**. Every statement it formats is re-parsed and
37
+ compared against the input as a syntax tree, and that tree is what "means" is
38
+ measured by here. If the output would differ, or would carry different comments,
39
+ or if the engine doesn't fully model the construct, the statement is passed
40
+ through **byte-identical** with a warning instead.
41
+
42
+ It reformats presentation and nothing else: identifiers, string literals, cast
43
+ form (`::` vs `CAST`), `GROUP BY` references, comments, and alias choices all
44
+ survive exactly as written. Two spellings do collapse at parse time and are
45
+ therefore sqlalign's to pick rather than yours — `!=` against `<>`, and
46
+ `decimal` against `numeric` — so both are settings rather than accidents.
47
+
48
+ It formats *inside* dollar-quoted (`$$`) plpgsql procedure and function bodies,
49
+ and **`--lint` reads inside them too, which sqlfluff cannot**: to its parser a
50
+ body is a single string literal, so nothing within one is ever linted.
39
51
 
40
52
  Its layout is **columnar alignment**: operators, aliases, `AS` clauses, and
41
53
  `ON`/`AND` conditions are padded into vertical columns by a fixpoint resolver —
42
- alignment is the layout engine itself, not a post-pass over already-printed text.
43
- It applies that same engine *inside* dollar-quoted (`$$`) plpgsql procedure and
44
- function bodies.
54
+ alignment is the layout engine itself, not a post-pass over already-printed
55
+ text.
45
56
 
46
57
  ```sql
47
58
  FROM customers cust
@@ -142,8 +153,19 @@ LEFT JOIN shipping_addresses addr ON addr.order_id = ord.order_id
142
153
  pip install sqlalign
143
154
  ```
144
155
 
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.
156
+ That puts a `sqlalign` command on your PATH.
157
+
158
+ If your environment already carries sqlglot — a dbt or SQLMesh project usually
159
+ does — install sqlalign in isolation instead, so the two version ranges cannot
160
+ collide:
161
+
162
+ ```sh
163
+ uv tool install sqlalign
164
+ ```
165
+
166
+ Releases are published from CI with [signed provenance](https://pypi.org/project/sqlalign/),
167
+ so PyPI records which repository and workflow built each artifact. For a tool
168
+ that rewrites your source files, that is worth checking.
147
169
 
148
170
  `--lint` runs sqlfluff over the formatted result and needs the optional extra:
149
171
 
@@ -151,8 +173,10 @@ environment, `uv tool install sqlalign` does the same thing in isolation.
151
173
  pip install 'sqlalign[lint]'
152
174
  ```
153
175
 
154
- Requires Python ≥ 3.12. Runtime dependency: `sqlglot` (pinned to the 30.14.x
155
- line — the layout engine depends on exact AST shapes; see `pyproject.toml`).
176
+ Requires Python ≥ 3.10. Runtime dependency: `sqlglot` (`>=30.14,<31` — the
177
+ layout engine reads exact AST shapes, which a test suite asserts by name across
178
+ the range; see `pyproject.toml`), plus `tomli` on 3.10, which later versions ship
179
+ as `tomllib`.
156
180
 
157
181
  To work on sqlalign itself, install from a clone instead — that adds the dev
158
182
  tools (`pytest`, `ruff`, `sqlfluff`):
@@ -164,11 +188,21 @@ uv sync
164
188
 
165
189
  ## Usage
166
190
 
191
+ Look before you leap — this is a formatter with an opinion, and the first thing
192
+ worth knowing is what it would do to your SQL:
193
+
194
+ ```sh
195
+ sqlalign --diff . # show what would change, write nothing
196
+ sqlalign --check . # exit non-zero if anything would change
197
+ ```
198
+
199
+ Then, once you have seen it:
200
+
167
201
  ```sh
168
202
  sqlalign query.sql # format in place (rewrites the file)
169
203
  sqlalign . # every *.sql under here, recursively
170
204
  sqlalign --stdout query.sql # print the formatted result, leave the file
171
- sqlalign --check *.sql # exit non-zero if any file is not formatted
205
+ cat query.sql | sqlalign - # read stdin, write stdout
172
206
  sqlalign --dialect redshift ddl.sql
173
207
  sqlalign --dialect tsql query.sql # SQL Server: TOP, [brackets]
174
208
  sqlalign --width 120 query.sql
@@ -203,8 +237,26 @@ WHERE ord.order_date >= '2026-07-01'
203
237
  AND cust.segment = 'enterprise';
204
238
  ```
205
239
 
240
+ ## In a pipeline
241
+
242
+ ```yaml
243
+ # .pre-commit-config.yaml # GitHub Actions
244
+ repos: - uses: pua2/sqlalign@v1.1.0
245
+ - repo: https://github.com/pua2/sqlalign # defaults to --check: a gate,
246
+ rev: v1.1.0 # not a formatter
247
+ hooks:
248
+ - id: sqlalign # or sqlalign-check to report only
249
+ ```
250
+
251
+ Details and editor recipes are in the [guide](docs/guide/getting-started.md).
252
+
206
253
  ## dbt / Jinja
207
254
 
255
+ **Scope first:** the templating is handled, the warehouses mostly are not.
256
+ sqlalign parses Postgres, Redshift and SQL Server, so a dbt project on Snowflake
257
+ or BigQuery will parse some models and decline others. Snowflake is the next
258
+ dialect. If your warehouse is one of the three, read on.
259
+
208
260
  Templated SQL isn't valid SQL, so most formatters decline it. sqlalign masks each
209
261
  template expression with a **same-width** placeholder, formats normally, then puts
210
262
  the original back — so alignment is computed against the real text width:
@@ -251,17 +303,26 @@ body_blank_lines = 1 # inside a $$ body
251
303
  river_gutter = 6
252
304
  ```
253
305
 
254
- Start from a **preset** and override what you want:
306
+ Start from a **preset** and override what you want. If your team already follows
307
+ a published style guide, start at `compact` or the guide's own preset rather than
308
+ at `house` — the alignment is the house opinion, not a prerequisite:
255
309
 
256
310
  | Preset | What it is |
257
311
  |---|---|
258
312
  | `house` | the columnar default — aligned, leading separators, `ON` inline |
259
- | `compact` | same line structure, no alignment padding (9 of 10 style guides are unpadded) |
313
+ | `compact` | **the one to start from if you follow a published guide** — same line structure, no alignment padding, which is what 9 of 10 of them ask for |
260
314
  | `trailing` | keeps the alignment, moves commas and `AND`/`OR` to end of line |
261
315
  | `dbt` | lowercase keywords, list stacked under a bare `select` at 4, trailing commas, no padding (one deviation: a CTE body indents 2, not 4) |
262
316
  | `river` | [Holywell's guide](https://www.sqlstyle.guide/) — root keywords right-aligned to a 6-column gutter, joins on the far side of it, otherwise unpadded |
263
317
  | `gitlab` | [GitLab's published guide](https://handbook.gitlab.com/handbook/enterprise-data/platform/sql-style-guide/) — list stacked at 2, trailing commas, `ON` on its own line, `AS` on table aliases, and column aliases the only thing aligned |
264
318
 
319
+ One consequence worth knowing before you adopt `house`: **alignment padding means
320
+ a diff is wider than the line you edited.** Rename a column to something longer
321
+ and every row in that block shifts to keep the column, so a one-token change can
322
+ touch twenty lines. That is inherent to columnar alignment rather than a bug in
323
+ this implementation — `compact` and `--no-align` keep the line structure and drop
324
+ the padding, and both make a diff show only what changed.
325
+
265
326
  ```toml
266
327
  preset = "compact"
267
328
  comma_position = "trailing" # layers on top of the preset
@@ -345,7 +406,7 @@ not cover.
345
406
 
346
407
  ## Guarantees & scope
347
408
 
348
- - **Byte-for-byte golden fixtures** — 25 hand-formatted samples in
409
+ - **Byte-for-byte golden fixtures** — 29 hand-formatted samples in
349
410
  `tests/fixtures/expected/` are the executable specification of the style; the
350
411
  suite asserts `format(input) == expected` for every one, plus idempotency
351
412
  (`format(expected) == expected`) and AST-equivalence.
@@ -414,6 +475,12 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). In short: `uv sync`, then `uv run pytest
414
475
  every pull request. The goldens in `tests/fixtures/expected/` are the
415
476
  specification, not snapshots.
416
477
 
478
+ **The style does not change in a patch release.** The goldens in
479
+ `tests/fixtures/expected/` are compared byte for byte in their own CI job, so an
480
+ unintended layout change cannot reach a release; an intended one waits for a
481
+ minor version and is named in the changelog. See
482
+ [Stability](docs/guide/style.md).
483
+
417
484
  Release notes are in [CHANGELOG.md](CHANGELOG.md).
418
485
 
419
486
  ## Reference