sqlalign 1.0.2__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.
Files changed (274) hide show
  1. sqlalign-1.2.0/.github/workflows/ci.yml +168 -0
  2. sqlalign-1.2.0/.gitignore +10 -0
  3. sqlalign-1.2.0/.pre-commit-hooks.yaml +25 -0
  4. sqlalign-1.2.0/CHANGELOG.md +276 -0
  5. {sqlalign-1.0.2 → sqlalign-1.2.0}/CONTRIBUTING.md +13 -5
  6. {sqlalign-1.0.2 → sqlalign-1.2.0}/PKG-INFO +88 -21
  7. {sqlalign-1.0.2 → sqlalign-1.2.0}/README.md +82 -18
  8. sqlalign-1.2.0/action.yml +62 -0
  9. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/guide/architecture.md +27 -12
  10. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/guide/cli.md +21 -9
  11. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/guide/configuration.md +3 -3
  12. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/guide/dialects.md +18 -1
  13. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/guide/faq.md +62 -16
  14. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/guide/getting-started.md +147 -24
  15. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/guide/style.md +43 -11
  16. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/v1/architecture.html +25 -13
  17. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/v1/cli.html +32 -11
  18. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/v1/configuration.html +5 -5
  19. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/v1/dialects.html +14 -2
  20. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/v1/faq.html +64 -20
  21. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/v1/getting-started.html +139 -24
  22. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/v1/index.html +1 -1
  23. sqlalign-1.2.0/docs/v1/search-index.json +1 -0
  24. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/v1/settings.html +1 -1
  25. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/v1/style.html +48 -13
  26. {sqlalign-1.0.2 → sqlalign-1.2.0}/pyproject.toml +38 -10
  27. sqlalign-1.2.0/src/sqlalign/__init__.py +90 -0
  28. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/cli.py +176 -20
  29. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/configfile.py +83 -6
  30. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/formatter.py +124 -7
  31. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/gui.py +83 -5
  32. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/keywordcase.py +8 -2
  33. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/__init__.py +19 -0
  34. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/conditions.py +50 -3
  35. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/cte.py +7 -2
  36. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/ddl.py +22 -1
  37. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/grouporder.py +28 -3
  38. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/plpgsql.py +60 -5
  39. sqlalign-1.2.0/src/sqlalign/spelling.py +110 -0
  40. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/style.py +26 -0
  41. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/conftest.py +12 -0
  42. sqlalign-1.2.0/tests/corpus/README.md +38 -0
  43. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__math__log_natural.sql +27 -0
  44. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__math__median.sql +3 -0
  45. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__math__percentile_cont.sql +18 -0
  46. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__math__rand.sql +39 -0
  47. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__regex__regexp_instr.sql +112 -0
  48. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests___generalized___ignore_row_if_expression.sql +20 -0
  49. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests___generalized___truth_expression.sql +8 -0
  50. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests___generalized__equal_expression.sql +110 -0
  51. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests___generalized__expression_between.sql +44 -0
  52. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests___generalized__expression_is_true.sql +58 -0
  53. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_count_to_be_greater_than.sql +15 -0
  54. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_count_to_be_less_than.sql +15 -0
  55. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_count_to_equal.sql +15 -0
  56. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_count_to_equal_other_table.sql +26 -0
  57. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_values_to_be_in_set.sql +55 -0
  58. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_values_to_contain_set.sql +54 -0
  59. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_distinct_values_to_equal_set.sql +55 -0
  60. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_max_to_be_between.sql +19 -0
  61. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_mean_to_be_between.sql +19 -0
  62. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_median_to_be_between.sql +20 -0
  63. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_min_to_be_between.sql +20 -0
  64. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_most_common_value_to_be_in_set.sql +100 -0
  65. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_proportion_of_unique_values_to_be_between.sql +20 -0
  66. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_quantile_values_to_be_between.sql +21 -0
  67. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_stdev_to_be_between.sql +38 -0
  68. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_sum_to_be_between.sql +19 -0
  69. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__aggregate_functions__expect_column_unique_value_count_to_be_between.sql +19 -0
  70. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_between.sql +22 -0
  71. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_decreasing.sql +58 -0
  72. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_in_set.sql +46 -0
  73. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_in_type_list.sql +32 -0
  74. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_increasing.sql +60 -0
  75. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_null.sql +11 -0
  76. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_of_type.sql +4 -0
  77. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_be_unique.sql +3 -0
  78. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_have_consistent_casing.sql +41 -0
  79. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_not_be_in_set.sql +44 -0
  80. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__column_values_basic__expect_column_values_to_not_be_null.sql +11 -0
  81. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__distributional__expect_column_values_to_be_within_n_moving_stdevs.sql +152 -0
  82. sqlalign-1.2.0/tests/corpus/dbt-expectations/macros__schema_tests__distributional__expect_column_values_to_be_within_n_stdevs.sql +57 -0
  83. sqlalign-1.2.0/tests/corpus/jaffle-shop/models__customers.sql +69 -0
  84. sqlalign-1.2.0/tests/corpus/jaffle-shop/models__orders.sql +56 -0
  85. sqlalign-1.2.0/tests/corpus/jaffle-shop/models__staging__stg_customers.sql +22 -0
  86. sqlalign-1.2.0/tests/corpus/jaffle-shop/models__staging__stg_orders.sql +23 -0
  87. sqlalign-1.2.0/tests/corpus/jaffle-shop/models__staging__stg_payments.sql +25 -0
  88. sqlalign-1.2.0/tests/corpus/sqlglot/tests__fixtures__identity.sql +977 -0
  89. sqlalign-1.2.0/tests/corpus/sqlglot/tests__fixtures__optimizer__optimizer.sql +1592 -0
  90. sqlalign-1.2.0/tests/corpus/sqlglot/tests__fixtures__pretty.sql +524 -0
  91. sqlalign-1.2.0/tests/test_benchmark_tool.py +28 -0
  92. sqlalign-1.2.0/tests/test_body_comments.py +73 -0
  93. sqlalign-1.2.0/tests/test_comment_safety.py +118 -0
  94. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_construct_sweep.py +4 -1
  95. sqlalign-1.2.0/tests/test_corpus.py +107 -0
  96. sqlalign-1.2.0/tests/test_dialect_config.py +129 -0
  97. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_docs_site.py +35 -0
  98. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_fetch_and_lateral_subquery.py +2 -2
  99. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_gui.py +105 -2
  100. sqlalign-1.2.0/tests/test_init_config.py +127 -0
  101. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_keyword_case.py +28 -0
  102. sqlalign-1.2.0/tests/test_negated_is_null.py +104 -0
  103. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_no_silent_declines.py +12 -1
  104. sqlalign-1.2.0/tests/test_packaging.py +186 -0
  105. sqlalign-1.2.0/tests/test_positioning.py +187 -0
  106. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_quoted_column_aliases.py +38 -0
  107. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_report.py +6 -1
  108. sqlalign-1.2.0/tests/test_report_growth_and_policy.py +84 -0
  109. sqlalign-1.2.0/tests/test_rewrite_guard.py +96 -0
  110. sqlalign-1.2.0/tests/test_sqlglot_conformance.py +175 -0
  111. sqlalign-1.2.0/tests/test_stdin_and_api.py +236 -0
  112. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_tsql.py +26 -1
  113. sqlalign-1.2.0/tools/benchmark.py +87 -0
  114. {sqlalign-1.0.2 → sqlalign-1.2.0}/tools/build_docs.py +31 -2
  115. {sqlalign-1.0.2 → sqlalign-1.2.0}/tools/docs_settings.py +19 -19
  116. sqlalign-1.2.0/tools/fetch_corpus.py +146 -0
  117. {sqlalign-1.0.2 → sqlalign-1.2.0}/uv.lock +168 -3
  118. sqlalign-1.0.2/.github/workflows/ci.yml +0 -95
  119. sqlalign-1.0.2/.gitignore +0 -18
  120. sqlalign-1.0.2/CHANGELOG.md +0 -140
  121. sqlalign-1.0.2/docs/.nojekyll +0 -0
  122. sqlalign-1.0.2/docs/CNAME +0 -1
  123. sqlalign-1.0.2/docs/sql-style-guide.md +0 -569
  124. sqlalign-1.0.2/docs/v1/search-index.json +0 -1
  125. sqlalign-1.0.2/src/sqlalign/__init__.py +0 -10
  126. sqlalign-1.0.2/tests/test_packaging.py +0 -75
  127. {sqlalign-1.0.2 → sqlalign-1.2.0}/.github/workflows/release.yml +0 -0
  128. {sqlalign-1.0.2 → sqlalign-1.2.0}/.sqlfluff +0 -0
  129. {sqlalign-1.0.2 → sqlalign-1.2.0}/LICENSE +0 -0
  130. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/guide/README.md +0 -0
  131. {sqlalign-1.0.2 → sqlalign-1.2.0}/docs/index.html +0 -0
  132. {sqlalign-1.0.2 → sqlalign-1.2.0}/samples/queries.sql +0 -0
  133. {sqlalign-1.0.2 → sqlalign-1.2.0}/scripts/build_fixtures.py +0 -0
  134. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/align.py +0 -0
  135. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/bodylint.py +0 -0
  136. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/casing.py +0 -0
  137. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/commas.py +0 -0
  138. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/config.py +0 -0
  139. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/ir.py +0 -0
  140. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/case.py +0 -0
  141. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/comments.py +0 -0
  142. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/dml.py +0 -0
  143. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/expr.py +0 -0
  144. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/fromjoin.py +0 -0
  145. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/select.py +0 -0
  146. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/setop.py +0 -0
  147. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/subquery.py +0 -0
  148. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/layout/window.py +0 -0
  149. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/lint.py +0 -0
  150. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/py.typed +0 -0
  151. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/splitter.py +0 -0
  152. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/sqlfluffconfig.py +0 -0
  153. {sqlalign-1.0.2 → sqlalign-1.2.0}/src/sqlalign/templating.py +0 -0
  154. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/docs/dbt.sql +0 -0
  155. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/docs/fromblock.sql +0 -0
  156. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/docs/hero.sql +0 -0
  157. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/docs/plpgsql.sql +0 -0
  158. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/01.sql +0 -0
  159. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/02.sql +0 -0
  160. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/03.sql +0 -0
  161. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/04.sql +0 -0
  162. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/05.sql +0 -0
  163. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/06.sql +0 -0
  164. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/07.sql +0 -0
  165. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/08.sql +0 -0
  166. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/09.sql +0 -0
  167. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/10.sql +0 -0
  168. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/11.sql +0 -0
  169. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/12.sql +0 -0
  170. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/13.sql +0 -0
  171. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/14.sql +0 -0
  172. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/15.sql +0 -0
  173. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/16.sql +0 -0
  174. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/17.sql +0 -0
  175. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/18.sql +0 -0
  176. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/19.sql +0 -0
  177. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/20.sql +0 -0
  178. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/21.sql +0 -0
  179. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/22.sql +0 -0
  180. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/23.sql +0 -0
  181. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/24.sql +0 -0
  182. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/25.sql +0 -0
  183. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/26.sql +0 -0
  184. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/27.sql +0 -0
  185. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/28.sql +0 -0
  186. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/expected/29.sql +0 -0
  187. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/01.sql +0 -0
  188. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/02.sql +0 -0
  189. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/03.sql +0 -0
  190. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/04.sql +0 -0
  191. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/05.sql +0 -0
  192. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/06.sql +0 -0
  193. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/07.sql +0 -0
  194. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/08.sql +0 -0
  195. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/09.sql +0 -0
  196. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/10.sql +0 -0
  197. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/11.sql +0 -0
  198. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/12.sql +0 -0
  199. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/13.sql +0 -0
  200. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/14.sql +0 -0
  201. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/15.sql +0 -0
  202. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/16.sql +0 -0
  203. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/17.sql +0 -0
  204. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/18.sql +0 -0
  205. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/19.sql +0 -0
  206. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/20.sql +0 -0
  207. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/21.sql +0 -0
  208. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/22.sql +0 -0
  209. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/23.sql +0 -0
  210. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/24.sql +0 -0
  211. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/25.sql +0 -0
  212. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/26.sql +0 -0
  213. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/27.sql +0 -0
  214. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/28.sql +0 -0
  215. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/fixtures/input/29.sql +0 -0
  216. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_align.py +0 -0
  217. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_align_off.py +0 -0
  218. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_align_targets.py +0 -0
  219. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_ast_equiv.py +0 -0
  220. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_atomic_writes.py +0 -0
  221. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_axis_matrix.py +0 -0
  222. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_blank_lines.py +0 -0
  223. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_bodylint.py +0 -0
  224. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_boolean_position.py +0 -0
  225. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_casing.py +0 -0
  226. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_clause_order.py +0 -0
  227. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_clauses.py +0 -0
  228. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_cli.py +0 -0
  229. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_comma_joins_lateral_udf.py +0 -0
  230. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_comma_position.py +0 -0
  231. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_comment_and_procedure_bugs.py +0 -0
  232. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_comments.py +0 -0
  233. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_comments_in_predicates.py +0 -0
  234. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_configfile.py +0 -0
  235. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_coverage_round_2.py +0 -0
  236. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_ddl.py +0 -0
  237. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_dialect_guard.py +0 -0
  238. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_distinct.py +0 -0
  239. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_dml.py +0 -0
  240. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_docs_examples.py +0 -0
  241. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_expr.py +0 -0
  242. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_file_selection.py +0 -0
  243. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_fromjoin.py +0 -0
  244. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_golden.py +0 -0
  245. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_knob_combinations.py +0 -0
  246. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_line_endings.py +0 -0
  247. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_lint_flag.py +0 -0
  248. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_nested_constructs.py +0 -0
  249. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_on_placement.py +0 -0
  250. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_pivot.py +0 -0
  251. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_plpgsql.py +0 -0
  252. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_presets.py +0 -0
  253. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_remaining_constructs.py +0 -0
  254. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_river.py +0 -0
  255. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_robustness.py +0 -0
  256. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_safety.py +0 -0
  257. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_select_placement.py +0 -0
  258. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_skip.py +0 -0
  259. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_splitter.py +0 -0
  260. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_sqlfluff_coexistence.py +0 -0
  261. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_sqlfluff_gate.py +0 -0
  262. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_style_knobs.py +0 -0
  263. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_subquery.py +0 -0
  264. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_table_alias.py +0 -0
  265. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_table_names.py +0 -0
  266. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_templating.py +0 -0
  267. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_trailing_punctuation.py +0 -0
  268. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_unaliased_tables.py +0 -0
  269. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_upstream_and_tail.py +0 -0
  270. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_values_and_joins.py +0 -0
  271. {sqlalign-1.0.2 → sqlalign-1.2.0}/tests/test_width_off_and_body_blanks.py +0 -0
  272. {sqlalign-1.0.2 → sqlalign-1.2.0}/tools/docs.css +0 -0
  273. {sqlalign-1.0.2 → sqlalign-1.2.0}/tools/docs.js +0 -0
  274. {sqlalign-1.0.2 → sqlalign-1.2.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]
@@ -0,0 +1,276 @@
1
+ # Changelog
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
+
57
+ ## 1.1.0
58
+
59
+ ### The guarantee now covers comments
60
+
61
+ Every statement was already re-parsed and compared as a syntax tree. Comments are
62
+ not in that tree — sqlglot hangs them off tokens — so the check passed whether or
63
+ not a comment survived, and the two worst bugs in this project's history lived in
64
+ that gap and were semantic rather than cosmetic: `SELECT a -- c,` lost a
65
+ separator, and `SELECT a -- note;` left the statement unterminated so it swallowed
66
+ the next one.
67
+
68
+ Each statement is now also compared on the comments it carries, and one that
69
+ would differ is passed through byte-identical like any other. Text and order are
70
+ compared, not position: the layout deliberately moves a comment to the end of the
71
+ row above. Comments inside a `$$` body remain outside this check; those
72
+ statements are compared structurally instead.
73
+
74
+ ### Running it where you already work
75
+
76
+ - **pre-commit hooks and a GitHub Action.** `sqlalign` rewrites and fails so you
77
+ restage; `sqlalign-check` only reports. The action defaults to `--check`,
78
+ because an action that silently reformats a checkout is not what a gate is for.
79
+ - **`sqlalign -`** reads stdin and writes stdout, which is what an editor's
80
+ format-on-save runs. `--check` and `--diff` still report rather than write.
81
+ - **A Python API.** `sqlalign.format` returns the text; `sqlalign.format_result`
82
+ also returns what happened. Both exist because a statement sqlalign cannot
83
+ model comes back byte-identical rather than raising, so the simple function
84
+ cannot tell "formatted" from "left alone".
85
+ - **`sqlalign --init`** writes a starter `.sqlalign.toml`, every setting
86
+ commented out. A starter that pinned eighteen settings would freeze you on the
87
+ day's defaults and call it a decision.
88
+
89
+ ### Wider support
90
+
91
+ - **Python 3.10 and 3.11.** Nothing in the engine needed porting; `tomllib` gets
92
+ a shim below 3.11. CI runs all four versions, and a test compares the
93
+ classifiers, the `requires-python` floor and the CI matrix against each other.
94
+ - **sqlglot `>=30.14,<31`** rather than a single patch line. The range is safe
95
+ because `tests/test_sqlglot_conformance.py` asserts each AST shape the layout
96
+ reads, and CI runs the whole suite against the newest release the range allows.
97
+ The safety net cannot catch an upstream shape change on its own: it compares
98
+ output to input under the same sqlglot, so both sides move together.
99
+
100
+ ### Fixed
101
+
102
+ - **Comments inside a `$$` body were keyword-cased, with the terminator spliced
103
+ into the comment.** `-- log it for the user` shipped as
104
+ `-- LOG it FOR the user;` with no decline. A same-line trailing comment is now
105
+ reproduced verbatim; a comment position the body renderer does not model
106
+ declines instead of guessing — the same contract the SQL comment engine
107
+ follows, now held on both sides of the dollar quotes.
108
+ - **`--report` and `--max-declines` were blind to templated files.** The
109
+ Jinja/dbt path dropped the statement and decline counts, so most of a dbt
110
+ project was invisible to the coverage gate.
111
+ - **A quoted identifier immunised the keyword it was spelled as.**
112
+ `SELECT a AS "FROM"` under `keyword_case = "lower"` left the real `FROM`
113
+ upper in an otherwise lowercase file.
114
+ - **`sqlalign - | head` dumped a traceback.** The command now exits `141`, the
115
+ shell's spelling of death-by-SIGPIPE.
116
+ - `WITH "cte" AS (...)` declined. The CTE name printed from `.alias`, which
117
+ strips quoting, so the output named a different relation. Machine-generated SQL
118
+ quotes every identifier, so this affected a whole class of input.
119
+ - `WHERE NOT b IS NULL` declined under Postgres. The renderer rewrote it to
120
+ `b IS NOT NULL` — the same meaning, but not what was written. Whether the two
121
+ spellings can be told apart is a property of the dialect, so it is now probed
122
+ rather than assumed.
123
+
124
+ Both were found by a new corpus suite that runs the formatter over third-party
125
+ SQL — sqlglot's own fixtures, dbt's example project, and a macro-heavy dbt
126
+ package — vendored at pinned commits.
127
+
128
+ ### Also
129
+
130
+ - `--report` names the construct declining most often and links a pre-filled
131
+ issue, so a coverage gap measured on your SQL has somewhere to go.
132
+ - The settings panel says why a control is greyed out, and the config it writes
133
+ records where it came from.
134
+ - A published benchmark (`tools/benchmark.py`): about 180 files/s, which is why
135
+ there is no `--jobs` flag.
136
+ - The style stability policy is written down: no style change in a patch release,
137
+ enforced by byte-exact goldens in their own CI job.
138
+
139
+ ## 1.0.2
140
+
141
+ ### Fixed
142
+
143
+ **An interrupted run could truncate the file it was formatting.** Writing with
144
+ `open(path, "w")` empties the file before the replacement is written, so a run
145
+ stopped part way through -- Ctrl-C over a large repository, a full disk, a
146
+ killed process -- left some file holding a prefix of its formatted self, with
147
+ the original gone. Files are now written to a neighbour and renamed into place,
148
+ so what is on disk is either the whole old file or the whole new one. Symlinks
149
+ are written through rather than replaced, and permissions are carried across.
150
+
151
+ **A file that was not UTF-8 raised a traceback and aborted the run.** The read
152
+ is UTF-8, and a `UnicodeDecodeError` is not an `OSError`, so it escaped the
153
+ per-file handler and took the whole invocation with it — every file after the
154
+ first undecodable one was silently never formatted. Such a file is now reported
155
+ and left exactly as it is: guessing an encoding would mean writing it back in a
156
+ different one, which is the kind of change sqlalign exists not to make.
157
+
158
+ **An unwritable file raised a traceback and aborted the run.** A read-only file
159
+ now reports `sqlalign: [Errno 13] Permission denied: <path>`, exits `2`, and
160
+ leaves the remaining files to process -- which is what the exit-code table
161
+ already documented.
162
+
163
+ `py.typed` was missing, so every type checker skipped the package while the
164
+ `Typing :: Typed` classifier said the opposite. sqlalign is annotated and
165
+ `format_sql` is importable; both now work as advertised.
166
+
167
+ `--gui`'s missing-tkinter message went to stdout rather than stderr.
168
+
169
+ `--lint` no longer warns about a sqlfluff patch release. The coexistence config
170
+ is checked against a known sqlfluff, and any difference warned; sqlfluff 4.3.0
171
+ then shipped, so every run printed a note about a release that had moved nothing
172
+ sqlalign uses. The check now compares the series, and is silent for a sqlfluff
173
+ older than the checked one -- the floor on the `lint` extra bounds that, and CI
174
+ now runs the coexistence tests against it. The mappings are verified against
175
+ sqlfluff 4.3.0.
176
+
177
+ ### Documentation
178
+
179
+ `--report` and `--max-declines` add output without changing the mode, so on
180
+ their own they rewrite the files they counted. The dialects guide told you to
181
+ run `sqlalign --report` over your own SQL to see what declined, which would have
182
+ reformatted the repository you were surveying. Both the guide and the flag's
183
+ help now say to pair it with `--check`.
184
+
185
+ Install instructions said `uv tool install .`, which installs from a clone. That
186
+ was the only option before the package was published; it is now
187
+ `pip install sqlalign`. The CI example in the guide told you to run that same
188
+ command inside your own repository, where it would have tried to install your
189
+ SQL repo as a Python package.
190
+
191
+ Also corrected: `--preset` documented four of its six values (`gitlab` and
192
+ `river` were missing), three places still said the project had no CI, and the
193
+ README linked the settings reference as a raw HTML file rather than to the
194
+ published site. Documented choice lists are now checked against the argument
195
+ parser by a test.
196
+
197
+ ## 1.0.1
198
+
199
+ No functional change. `1.0.0` was tagged before the package was ever published,
200
+ so this is the first version to reach an index.
201
+
202
+ ## 1.0.0
203
+
204
+ First release.
205
+
206
+ sqlalign formats SQL into a columnar, aligned house style, and re-parses every
207
+ statement it writes to prove it did not change what the SQL means.
208
+
209
+ ### The guarantee
210
+
211
+ Every statement is re-parsed after formatting and compared against the input as
212
+ a syntax tree. If the output would differ semantically — or if the engine does
213
+ not fully model the construct — that statement is passed through byte-identical
214
+ with a warning instead, and the run still exits `0`.
215
+
216
+ A passthrough is not a failure. It is what makes the tool safe to run across a
217
+ repository you did not write.
218
+
219
+ ### Formatting
220
+
221
+ - **Postgres, Redshift and SQL Server**, selected with `--dialect`. Adding a
222
+ dialect requires auditing every keyword the layout emits, because the AST
223
+ check cannot catch output that is valid SQL but invalid for the target
224
+ engine — so the list is short and deliberate.
225
+ - **plpgsql `$$` bodies are formatted**, statement by statement, rather than
226
+ treated as an opaque string.
227
+ - **Jinja and dbt templating** is masked before parsing, so a templated model
228
+ formats instead of failing to parse.
229
+ - Comments are reproduced faithfully or the statement declines — never moved,
230
+ never restyled.
231
+
232
+ ### Configuration
233
+
234
+ - `.sqlalign.toml`, with CLI flags overriding it for a single run.
235
+ - **18 style options**, each documented with the same SQL rendered under each of
236
+ its values.
237
+ - **Six presets**: `house`, `compact`, `trailing`, `dbt`, `gitlab`, `river`. The
238
+ last two reproduce their source style guides byte for byte and are pinned to
239
+ those documents by tests.
240
+ - Alignment is one mechanism with a list of targets, so a team can keep the
241
+ join-condition column and drop the rest — or turn padding off entirely with
242
+ `--no-align` and keep the line structure, which is what most published style
243
+ guides ask for.
244
+
245
+ ### Running it
246
+
247
+ - Files or directories, with `--exclude` globs.
248
+ - `--check` for CI, `--diff` to preview, `--stdout` to pipe.
249
+ - `--report` counts what declined and ranks the causes, so a passthrough stops
250
+ being invisible; `--max-declines N` turns that into a gate.
251
+ - `--gui` opens a settings panel with a live preview. **Experimental** — the
252
+ CLI and config file are the supported surface.
253
+
254
+ ### Alongside sqlfluff
255
+
256
+ - `--print-sqlfluff-config` generates a config that stops the two tools
257
+ fighting: sqlalign owns layout, so the whole `layout` rule group is excluded
258
+ by name, and every semantic rule stays on.
259
+ - `--lint` runs sqlfluff over the formatted result in the same command.
260
+ - **`--lint` reads inside `$$` bodies, which sqlfluff cannot.** To its parser a
261
+ plpgsql body is a single string literal, so nothing inside one is ever linted.
262
+ sqlalign already locates those statements in order to format them, and hands
263
+ them over with their real line and column numbers.
264
+
265
+ ### Known limits
266
+
267
+ These decline rather than guess, and say why:
268
+
269
+ - `PIVOT`/`UNPIVOT` under Postgres, which has no such syntax.
270
+ - T-SQL `IF`/`WHILE` inside a procedure body: sqlglot leaves part of the body
271
+ unparsed, including the whole `ELSE` branch, so laying out the tree would drop
272
+ it silently.
273
+ - A comment buried inside an expression, or in a positional `GROUP BY 1, 2` —
274
+ neither has a row of its own to sit on.
275
+ - Constructs sqlglot cannot parse or cannot round-trip through its own
276
+ generator. `--report` names each one.
@@ -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