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