sqlassert 0.3.3__tar.gz → 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (418) hide show
  1. {sqlassert-0.3.3 → sqlassert-0.4.2}/.github/workflows/ci.yml +30 -16
  2. sqlassert-0.3.3/.github/workflows/demo-pages.yml → sqlassert-0.4.2/.github/workflows/pages.yml +13 -9
  3. {sqlassert-0.3.3 → sqlassert-0.4.2}/.gitignore +5 -2
  4. {sqlassert-0.3.3 → sqlassert-0.4.2}/AGENTS.md +33 -7
  5. {sqlassert-0.3.3 → sqlassert-0.4.2}/CONTEXT.md +127 -42
  6. sqlassert-0.4.2/PKG-INFO +239 -0
  7. sqlassert-0.4.2/README.md +204 -0
  8. sqlassert-0.4.2/docs/adr/0002-use-a-framework-independent-ir.md +5 -0
  9. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/adr/0005-analyze-sql-without-a-connection.md +2 -0
  10. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/adr/0006-model-only-current-strict-engines.md +3 -1
  11. sqlassert-0.4.2/docs/adr/0007-exact-comparisons-assume-values-in-range.md +20 -0
  12. sqlassert-0.4.2/docs/adr/0008-best-effort-on-sql-the-user-should-fix.md +13 -0
  13. sqlassert-0.4.2/docs/adr/0009-equal-and-fixing-comparisons.md +84 -0
  14. sqlassert-0.4.2/docs/adr/0010-what-a-rewrite-preserves.md +12 -0
  15. sqlassert-0.4.2/docs/adr/0011-builtin-properties-are-functions-of-their-arguments.md +36 -0
  16. sqlassert-0.4.2/docs/adr/0012-trust-every-declared-constraint.md +21 -0
  17. sqlassert-0.4.2/docs/adr/0013-one-function-table.md +26 -0
  18. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/assets/sqlassert-demo.html +4 -2
  19. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/calcite-audit.md +7 -6
  20. sqlassert-0.4.2/docs/dialect-provenance.json +1897 -0
  21. sqlassert-0.4.2/docs/dialects.md +917 -0
  22. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/functional-dependencies.md +28 -19
  23. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/implementation-conventions.md +200 -44
  24. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0027-soundness-oracle-against-duckdb.md +11 -7
  25. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0039-smaller-lowering-gaps.md +2 -2
  26. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0042-lowering-support-v2.md +7 -1
  27. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0051-validate-snowflake-against-a-real-engine.md +2 -3
  28. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0052-validate-bigquery-against-a-real-engine.md +1 -2
  29. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0053-validate-databricks-against-a-real-engine.md +3 -3
  30. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0054-validate-redshift-against-a-real-engine.md +2 -3
  31. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0057-dbt-incremental-models.md +2 -1
  32. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0061-symbolic-oracle-with-verieql.md +4 -2
  33. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0070-decide-whether-to-warn-on-hidden-join-fanout-by-default.md +17 -1
  34. sqlassert-0.4.2/docs/issues/0073-pending-lowering-and-classification-decisions.md +132 -0
  35. sqlassert-0.4.2/docs/issues/0076-asof-join.md +29 -0
  36. sqlassert-0.4.2/docs/issues/0077-range-joins-against-constant-tables.md +36 -0
  37. sqlassert-0.4.2/docs/issues/0078-read-casts-that-keep-a-literals-value-in-check-constraints.md +43 -0
  38. sqlassert-0.4.2/docs/issues/0079-profile-and-optimize-analysis-time.md +65 -0
  39. sqlassert-0.4.2/docs/issues/0082-dbt-custom-tests-read-from-their-sql.md +92 -0
  40. sqlassert-0.4.2/docs/issues/0083-flags-to-distrust-declared-constraints-by-source.md +47 -0
  41. sqlassert-0.4.2/docs/issues/0084-clickhouse-key-semantics.md +63 -0
  42. sqlassert-0.4.2/docs/issues/README.md +27 -0
  43. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0012-add-unique-set-assertions-for-select-expressions-unique-prim.md +1 -1
  44. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0023-close-ir-lowering-gaps.md +1 -1
  45. sqlassert-0.4.2/docs/issues/done/0072-type-computed-select-items.md +56 -0
  46. sqlassert-0.4.2/docs/issues/done/0074-adr-on-integer-comparisons-and-implicit-casts.md +92 -0
  47. sqlassert-0.4.2/docs/issues/done/0075-make-explain-lead-to-the-cause.md +430 -0
  48. sqlassert-0.4.2/docs/issues/done/0080-builtin-properties-as-functions-and-one-cast-table.md +86 -0
  49. sqlassert-0.4.2/docs/issues/done/0081-one-function-table.md +440 -0
  50. sqlassert-0.3.3/docs/issues/README.md → sqlassert-0.4.2/docs/issues/list.md +32 -9
  51. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/literature-notes.md +16 -7
  52. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/references.md +18 -1
  53. sqlassert-0.4.2/docs/site/assets/favicon.svg +1 -0
  54. sqlassert-0.4.2/docs/site/cli.md +162 -0
  55. sqlassert-0.4.2/docs/site/codes.md +85 -0
  56. sqlassert-0.4.2/docs/site/dbt.md +39 -0
  57. sqlassert-0.4.2/docs/site/dialects.md +76 -0
  58. sqlassert-0.4.2/docs/site/functions.md +160 -0
  59. sqlassert-0.4.2/docs/site/index.md +48 -0
  60. sqlassert-0.4.2/docs/site/markers.md +218 -0
  61. sqlassert-0.4.2/docs/site/proofs.md +63 -0
  62. sqlassert-0.4.2/docs/site/python.md +96 -0
  63. sqlassert-0.4.2/docs/site/quickstart.md +77 -0
  64. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/README.md +5 -7
  65. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/pyproject.toml +3 -3
  66. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/__init__.py +1 -1
  67. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/__main__.py +1 -1
  68. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/connect.py +6 -8
  69. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/expectations.py +49 -17
  70. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/manifest.py +52 -2
  71. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/program.py +187 -125
  72. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/project.py +8 -2
  73. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/conftest.py +7 -0
  74. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/test_contracts.py +2 -14
  75. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/test_dbt.py +54 -20
  76. sqlassert-0.4.2/integrations/dbt/tests/test_file_sources.py +114 -0
  77. {sqlassert-0.3.3 → sqlassert-0.4.2}/pyproject.toml +10 -1
  78. sqlassert-0.4.2/scripts/README.md +118 -0
  79. sqlassert-0.4.2/scripts/audit-new-base.md +230 -0
  80. sqlassert-0.4.2/scripts/audit.py +621 -0
  81. sqlassert-0.4.2/scripts/certify_dialects.py +1434 -0
  82. sqlassert-0.4.2/scripts/dbt_offline.py +44 -0
  83. sqlassert-0.4.2/scripts/function_table_docs.py +99 -0
  84. sqlassert-0.4.2/scripts/propose_typing.py +102 -0
  85. {sqlassert-0.3.3 → sqlassert-0.4.2}/scripts/render_sqlassert_interactive_demo.py +4 -2
  86. sqlassert-0.4.2/scripts/vendor_dbt_analysis.py +319 -0
  87. sqlassert-0.4.2/scripts/vendor_repository_inventory.py +158 -0
  88. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/__init__.py +1 -2
  89. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/check.py +88 -13
  90. sqlassert-0.4.2/sqlassert/declared_types.py +158 -0
  91. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/diagnostics.py +15 -7
  92. sqlassert-0.4.2/sqlassert/dialects.py +410 -0
  93. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/discovery/bigquery.py +4 -2
  94. sqlassert-0.4.2/sqlassert/discovery/databricks.py +39 -0
  95. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/discovery/duckdb.py +49 -7
  96. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/discovery/fetcher.py +137 -58
  97. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/discovery/information_schema.py +31 -6
  98. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/discovery/mysql.py +21 -4
  99. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/discovery/postgres.py +28 -20
  100. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/discovery/redshift.py +3 -2
  101. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/discovery/snowflake.py +5 -2
  102. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/discovery/trino.py +2 -2
  103. sqlassert-0.4.2/sqlassert/functions/__init__.py +10 -0
  104. sqlassert-0.4.2/sqlassert/functions/load.py +375 -0
  105. sqlassert-0.4.2/sqlassert/functions/table.py +2721 -0
  106. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/hazards.py +249 -88
  107. sqlassert-0.4.2/sqlassert/ir/__init__.py +69 -0
  108. sqlassert-0.4.2/sqlassert/ir/convert/__init__.py +13 -0
  109. sqlassert-0.4.2/sqlassert/ir/convert/aggregation.py +438 -0
  110. sqlassert-0.4.2/sqlassert/ir/convert/expressions.py +581 -0
  111. sqlassert-0.4.2/sqlassert/ir/convert/joins.py +264 -0
  112. sqlassert-0.4.2/sqlassert/ir/convert/markers.py +249 -0
  113. sqlassert-0.4.2/sqlassert/ir/convert/parser.py +249 -0
  114. sqlassert-0.4.2/sqlassert/ir/convert/queries.py +259 -0
  115. sqlassert-0.4.2/sqlassert/ir/convert/schema.py +537 -0
  116. sqlassert-0.4.2/sqlassert/ir/convert/scopes.py +205 -0
  117. sqlassert-0.4.2/sqlassert/ir/convert/selects.py +352 -0
  118. sqlassert-0.4.2/sqlassert/ir/convert/shared.py +428 -0
  119. sqlassert-0.4.2/sqlassert/ir/convert/sources.py +433 -0
  120. sqlassert-0.4.2/sqlassert/ir/convert/subqueries.py +364 -0
  121. sqlassert-0.4.2/sqlassert/ir/convert/value_types.py +78 -0
  122. sqlassert-0.4.2/sqlassert/ir/convert/windows.py +275 -0
  123. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/ir/model.py +417 -146
  124. sqlassert-0.4.2/sqlassert/ir/names.py +63 -0
  125. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/main.py +7 -10
  126. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/properties.py +12 -1
  127. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/provenance.py +5 -1
  128. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/python_engine.py +104 -44
  129. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/reporting.py +33 -32
  130. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/rewrites.py +111 -61
  131. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/rules/STYLEGUIDE.md +3 -2
  132. sqlassert-0.4.2/sqlassert/rules/causes/__init__.py +41 -0
  133. sqlassert-0.4.2/sqlassert/rules/causes/coverage.py +113 -0
  134. sqlassert-0.4.2/sqlassert/rules/causes/domain.py +123 -0
  135. sqlassert-0.4.2/sqlassert/rules/causes/joins.py +73 -0
  136. sqlassert-0.4.2/sqlassert/rules/causes/nulls.py +154 -0
  137. sqlassert-0.4.2/sqlassert/rules/causes/unique.py +564 -0
  138. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/rules/domain.py +9 -8
  139. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/rules/equality.py +6 -147
  140. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/rules/exactly_one.py +2 -1
  141. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/rules/foreign_key.py +8 -9
  142. sqlassert-0.4.2/sqlassert/rules/join_cardinality.py +350 -0
  143. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/rules/nullability.py +8 -8
  144. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/rules/uniqueness.py +212 -87
  145. sqlassert-0.4.2/sqlassert/rules/value_typing.py +470 -0
  146. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/sql_parse.py +28 -1
  147. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/suggest.py +13 -17
  148. sqlassert-0.4.2/sqlassert.egg-info/PKG-INFO +239 -0
  149. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert.egg-info/SOURCES.txt +94 -5
  150. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert.egg-info/requires.txt +6 -1
  151. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert.egg-info/scm_file_list.json +95 -6
  152. sqlassert-0.4.2/sqlassert.egg-info/scm_version.json +8 -0
  153. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/aggregate_and_distinct.sqltest +2 -2
  154. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/calcite_audit_keys.sqltest +3 -2
  155. sqlassert-0.4.2/tests/casts.sqltest +187 -0
  156. sqlassert-0.4.2/tests/check_constraints.sqltest +89 -0
  157. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/composite_unique_sets.sqltest +1 -2
  158. sqlassert-0.4.2/tests/computed_select_item_types.sqltest +451 -0
  159. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/cte_and_subquery.sqltest +9 -0
  160. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/dialect_duckdb.sqltest +3 -3
  161. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/dialect_mysql.sqltest +9 -24
  162. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/dialect_postgres.sqltest +12 -19
  163. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/dialect_trino.sqltest +7 -16
  164. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/dialect_warehouses.sqltest +35 -51
  165. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/enumerated_domain.sqltest +8 -1
  166. sqlassert-0.4.2/tests/exact_comparisons.sqltest +90 -0
  167. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/exactly_one_join.sqltest +10 -0
  168. sqlassert-0.4.2/tests/fixing_comparisons.sqltest +85 -0
  169. sqlassert-0.4.2/tests/function_typing.sqltest +112 -0
  170. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/functional_dependencies_of_functions.sqltest +137 -8
  171. sqlassert-0.4.2/tests/join_cardinality.sqltest +314 -0
  172. sqlassert-0.4.2/tests/join_kinds.sqltest +381 -0
  173. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/join_kinds_standalone.sqltest +1 -2
  174. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/lowering_having_values_subqueries.sqltest +1 -1
  175. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/nested_joins.sqltest +3 -3
  176. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/not_null.sqltest +7 -1
  177. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/not_null_rejection.sqltest +1 -1
  178. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/not_null_values.sqltest +17 -4
  179. sqlassert-0.4.2/tests/qualify_by_partition.sqltest +783 -0
  180. sqlassert-0.4.2/tests/recursive_cte.sqltest +268 -0
  181. sqlassert-0.4.2/tests/review_soundness.sqltest +236 -0
  182. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/root_select_body.sqltest +74 -0
  183. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/schema_amendments.sqltest +1 -1
  184. sqlassert-0.4.2/tests/set_operations.sqltest +268 -0
  185. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/set_returning_functions.sqltest +1 -1
  186. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/soundness_oracle.py +9 -11
  187. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/sqltest.py +24 -20
  188. sqlassert-0.4.2/tests/star_projection.sqltest +701 -0
  189. sqlassert-0.4.2/tests/table_functions.sqltest +196 -0
  190. sqlassert-0.4.2/tests/table_functions_bigquery.sqltest +47 -0
  191. sqlassert-0.4.2/tests/table_functions_databricks.sqltest +9 -0
  192. sqlassert-0.4.2/tests/table_functions_postgres.sqltest +166 -0
  193. sqlassert-0.4.2/tests/table_functions_redshift.sqltest +26 -0
  194. sqlassert-0.4.2/tests/table_functions_spark.sqltest +37 -0
  195. sqlassert-0.4.2/tests/table_functions_sqlite.sqltest +23 -0
  196. sqlassert-0.4.2/tests/table_functions_trino.sqltest +80 -0
  197. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_aggregate_and_distinct.py +9 -15
  198. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_qualify_by_partition.py +9 -10
  199. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_unique_set_assertion.py +0 -13
  200. sqlassert-0.4.2/tests/test_audit.py +43 -0
  201. sqlassert-0.4.2/tests/test_causes.py +503 -0
  202. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_check.py +8 -6
  203. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_database_hydration.py +44 -2
  204. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_dialect_certification.py +42 -9
  205. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_dialects.py +8 -23
  206. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_duckdb_hydration.py +48 -1
  207. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_equality_groups.py +13 -1
  208. sqlassert-0.4.2/tests/test_function_docs.py +34 -0
  209. sqlassert-0.4.2/tests/test_functions.py +147 -0
  210. sqlassert-0.4.2/tests/test_hazards.py +987 -0
  211. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_ir_model.py +21 -1
  212. sqlassert-0.4.2/tests/test_minimal_keys.py +93 -0
  213. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_mysql_catalog.py +26 -3
  214. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_oracle_plugin.py +2 -2
  215. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_postgres_catalog.py +64 -14
  216. sqlassert-0.4.2/tests/test_property_functions.py +19 -0
  217. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_python_engine.py +35 -4
  218. sqlassert-0.4.2/tests/test_required_columns.py +41 -0
  219. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_review_soundness.py +2 -6
  220. sqlassert-0.4.2/tests/test_schema_sources.py +150 -0
  221. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_suggest.py +32 -1
  222. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_suggest_rewrites.py +167 -11
  223. sqlassert-0.4.2/tests/test_unproved_join.py +251 -0
  224. sqlassert-0.4.2/tests/test_using_star_probe.py +55 -0
  225. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_warehouse_catalogs.py +32 -19
  226. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/unsupported_constructs.sqltest +72 -1
  227. sqlassert-0.4.2/tests/values_types.sqltest +232 -0
  228. sqlassert-0.4.2/uv.lock +576 -0
  229. sqlassert-0.4.2/zensical.toml +55 -0
  230. sqlassert-0.3.3/PKG-INFO +0 -807
  231. sqlassert-0.3.3/README.md +0 -777
  232. sqlassert-0.3.3/docs/adr/0002-use-a-framework-independent-ir.md +0 -3
  233. sqlassert-0.3.3/docs/dialect-provenance.json +0 -880
  234. sqlassert-0.3.3/docs/dialects.md +0 -365
  235. sqlassert-0.3.3/docs/mvp-scope.md +0 -38
  236. sqlassert-0.3.3/docs/site/index.html +0 -18
  237. sqlassert-0.3.3/scripts/README.md +0 -14
  238. sqlassert-0.3.3/scripts/certify_dialects.py +0 -716
  239. sqlassert-0.3.3/sqlassert/dialects.py +0 -258
  240. sqlassert-0.3.3/sqlassert/discovery/databricks.py +0 -18
  241. sqlassert-0.3.3/sqlassert/ir/__init__.py +0 -58
  242. sqlassert-0.3.3/sqlassert/ir/convert.py +0 -3509
  243. sqlassert-0.3.3/sqlassert/rules/join_cardinality.py +0 -116
  244. sqlassert-0.3.3/sqlassert.egg-info/PKG-INFO +0 -807
  245. sqlassert-0.3.3/sqlassert.egg-info/scm_version.json +0 -8
  246. sqlassert-0.3.3/tests/check_constraints.sqltest +0 -53
  247. sqlassert-0.3.3/tests/join_cardinality.sqltest +0 -48
  248. sqlassert-0.3.3/tests/join_kinds.sqltest +0 -215
  249. sqlassert-0.3.3/tests/qualify_by_partition.sqltest +0 -80
  250. sqlassert-0.3.3/tests/review_soundness.sqltest +0 -80
  251. sqlassert-0.3.3/tests/set_operations.sqltest +0 -73
  252. sqlassert-0.3.3/tests/test_analyze_relation_facts.py +0 -173
  253. sqlassert-0.3.3/tests/test_hazards.py +0 -386
  254. sqlassert-0.3.3/tests/test_property_functions.py +0 -18
  255. sqlassert-0.3.3/uv.lock +0 -253
  256. {sqlassert-0.3.3 → sqlassert-0.4.2}/CITATION.cff +0 -0
  257. {sqlassert-0.3.3 → sqlassert-0.4.2}/CLAUDE.md +0 -0
  258. {sqlassert-0.3.3 → sqlassert-0.4.2}/LICENSE +0 -0
  259. {sqlassert-0.3.3 → sqlassert-0.4.2}/case.sql +0 -0
  260. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/adr/0001-isolate-clingo-as-the-property-engine.md +0 -0
  261. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/adr/0003-encode-the-ir-in-clingo.md +0 -0
  262. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/adr/0004-use-python-analysis-functions-for-property-inference.md +0 -0
  263. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/assets/fan-trap.sql +0 -0
  264. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/assets/inner-join.sql +0 -0
  265. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/assets/redundant-join.sql +0 -0
  266. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/assets/social-preview.png +0 -0
  267. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/assets/sqlassert-demo-preview.png +0 -0
  268. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/calcite-notes.md +0 -0
  269. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0011-fuzz-test-analyze-against-a-real-world-sql-corpus.md +0 -0
  270. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0043-external-integrations.md +0 -0
  271. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0046-certify-dialect-facts.md +0 -0
  272. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0049-collation-aware-properties.md +0 -0
  273. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0058-dbt-source-mapping.md +0 -0
  274. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0059-postgres-user-defined-functions.md +0 -0
  275. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0060-audit-inference-against-cockroachdb.md +0 -0
  276. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0062-cross-check-suggest-rewrites-with-equivalence-checkers.md +0 -0
  277. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0063-generate-random-programs-for-the-oracle.md +0 -0
  278. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0064-triage-wetune-rewrite-rules.md +0 -0
  279. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0065-triage-sqlcheck-anti-patterns.md +0 -0
  280. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0066-check-semantics-against-guagliardo-libkin.md +0 -0
  281. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0067-recheck-calcite-funcdepset.md +0 -0
  282. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0068-name-suggestion-types-by-severity.md +0 -0
  283. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/0069-real-world-sql-corpora.md +0 -0
  284. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0001-spec-rewrite-the-property-engine-around-a-relational-ir-and.md +0 -0
  285. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0002-prove-one-declared-unique-join-through-clingo.md +0 -0
  286. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0003-prove-composite-and-nullable-unique-sets.md +0 -0
  287. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0004-propagate-uniqueness-through-relation-instances-filters-and.md +0 -0
  288. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0005-analyze-cte-and-from-subquery-plans.md +0 -0
  289. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0006-expand-create-views-with-provenance-and-cycle-detection.md +0 -0
  290. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0007-derive-uniqueness-from-aggregate-and-distinct.md +0 -0
  291. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0008-derive-uniqueness-from-qualifybypartition.md +0 -0
  292. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0009-return-conservative-diagnostics-for-the-complete-mvp-boundar.md +0 -0
  293. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0010-cut-over-to-analyze-and-retire-the-legacy-analyzer.md +0 -0
  294. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0013-refactoring.md +0 -0
  295. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0014-hydrate-analysis-from-database-catalogs-with-recursive-view.md +0 -0
  296. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0015-suggest-provable-properties-for-unannotated-sql.md +0 -0
  297. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0016-assert-and-declare-string-enum-domains.md +0 -0
  298. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0017-complete-typed-enum-support.md +0 -0
  299. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0018-assert-exhaustive-simple-case-expressions.md +0 -0
  300. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0019-assert-and-declare-direct-foreign-keys.md +0 -0
  301. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0020-propagate-foreign-keys-through-queries.md +0 -0
  302. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0021-assert-simple-exactly-one-joins.md +0 -0
  303. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0022-complete-exactly-one-reasoning.md +0 -0
  304. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0024-functional-dependency-reasoning.md +0 -0
  305. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0025-check-rule-consistency-invariants.md +0 -0
  306. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0026-equality-groups.md +0 -0
  307. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0028-analyze-join-markers-inside-cte-bodies.md +0 -0
  308. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0029-enum-string-literals-may-coincide.md +0 -0
  309. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0030-read-enum-types-and-collations-from-the-catalog.md +0 -0
  310. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0031-enumerated-domains-through-set-operations.md +0 -0
  311. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0032-infer-simple-case-nullability.md +0 -0
  312. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0033-inner-join-suggestion-across-join-chains-and-ctes.md +0 -0
  313. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0034-close-soundness-oracle-blind-spots.md +0 -0
  314. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0035-audit-fd-propagation-against-paulley.md +0 -0
  315. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0036-refactor-tests-for-corpus-and-oracle-scale.md +0 -0
  316. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0037-close-the-paulley-audit-missing-rules.md +0 -0
  317. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0038-lower-order-by-and-select-list-subqueries.md +0 -0
  318. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0040-audit-inference-against-calcite.md +0 -0
  319. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0041-join-cardinality-markers-and-fan-trap-smell.md +0 -0
  320. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0044-v1-external-integrations.md +0 -0
  321. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0045-close-the-calcite-audit-missing-proofs.md +0 -0
  322. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0047-discovery-base-class.md +0 -0
  323. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0048-dbt-plugin-package.md +0 -0
  324. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0050-dbt-catalog-json.md +0 -0
  325. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0055-dbt-suggest-model-files.md +0 -0
  326. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0056-dbt-live-connection.md +0 -0
  327. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0070-drop-legacy-and-permissive-dialect-support.md +0 -0
  328. {sqlassert-0.3.3 → sqlassert-0.4.2}/docs/issues/done/0071-rewrites-carry-exact-edits.md +0 -0
  329. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/LICENSE +0 -0
  330. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/jinja.py +0 -0
  331. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/report.py +0 -0
  332. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/dbt_project.yml +0 -0
  333. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/active_customers.sql +0 -0
  334. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/customer_keys.sql +0 -0
  335. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/customer_orders.sql +0 -0
  336. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/customer_signups.sql +0 -0
  337. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/customers.sql +0 -0
  338. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/orders_appended.sql +0 -0
  339. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/orders_incremental.sql +0 -0
  340. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/schema.yml +0 -0
  341. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/stg_customers.sql +0 -0
  342. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/stg_orders.sql +0 -0
  343. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/profiles.yml +0 -0
  344. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/seeds/raw_payments.csv +0 -0
  345. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_runs.py +0 -0
  346. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/test_catalog.py +0 -0
  347. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/test_connect.py +0 -0
  348. {sqlassert-0.3.3 → sqlassert-0.4.2}/integrations/dbt/tests/test_suggest.py +0 -0
  349. {sqlassert-0.3.3 → sqlassert-0.4.2}/join.sql +0 -0
  350. {sqlassert-0.3.3 → sqlassert-0.4.2}/left.sql +0 -0
  351. {sqlassert-0.3.3 → sqlassert-0.4.2}/poetry.lock +0 -0
  352. {sqlassert-0.3.3 → sqlassert-0.4.2}/scripts/publish-pypi.sh +0 -0
  353. {sqlassert-0.3.3 → sqlassert-0.4.2}/scripts/render_sqlassert_social_preview.py +0 -0
  354. {sqlassert-0.3.3 → sqlassert-0.4.2}/setup.cfg +0 -0
  355. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/__main__.py +0 -0
  356. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/discovery/__init__.py +0 -0
  357. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/edits.py +0 -0
  358. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/rules/__init__.py +0 -0
  359. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert/rules/column_set.py +0 -0
  360. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert.egg-info/dependency_links.txt +0 -0
  361. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert.egg-info/entry_points.txt +0 -0
  362. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert.egg-info/top_level.txt +0 -0
  363. {sqlassert-0.3.3 → sqlassert-0.4.2}/sqlassert_cli.py +0 -0
  364. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/aggregates_in_expressions.sqltest +0 -0
  365. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/always_null_columns.sqltest +0 -0
  366. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/calcite_audit.sqltest +0 -0
  367. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/calcite_audit_iq.sqltest +0 -0
  368. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/calcite_audit_nulls.sqltest +0 -0
  369. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/conftest.py +0 -0
  370. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/connection_warnings.sqltest +0 -0
  371. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/database_hydration.sqltest +0 -0
  372. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/duckdb_hydration.sqltest +0 -0
  373. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/enumerated_domain_standalone.sqltest +0 -0
  374. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/exhaustive_case.sqltest +0 -0
  375. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/foreign_keys.sqltest +0 -0
  376. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/foreign_keys_standalone.sqltest +0 -0
  377. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/functional_dependencies.sqltest +0 -0
  378. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/functional_dependencies_standalone.sqltest +0 -0
  379. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/joins_in_bodies.sqltest +0 -0
  380. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/limit.sqltest +0 -0
  381. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/marker_accounting.sqltest +0 -0
  382. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/not_null_case_expressions.sqltest +0 -0
  383. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/not_null_standalone.sqltest +0 -0
  384. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/paulley_audit.sqltest +0 -0
  385. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/propagation.sqltest +0 -0
  386. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/scalar_aggregates.sqltest +0 -0
  387. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/scalar_subqueries.sqltest +0 -0
  388. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/schema_amendments_standalone.sqltest +0 -0
  389. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/soundness.sqltest +0 -0
  390. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/subqueries.sqltest +0 -0
  391. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_cte_and_subquery.py +0 -0
  392. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_enumerated_domain.py +0 -0
  393. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_exactly_one_join.py +0 -0
  394. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_exhaustive_case.py +0 -0
  395. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_join_cardinality.py +0 -0
  396. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_join_kinds.py +0 -0
  397. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_joins_in_bodies.py +0 -0
  398. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_marker_accounting.py +0 -0
  399. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_not_null.py +0 -0
  400. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_scalar_subqueries.py +0 -0
  401. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_set_operations.py +0 -0
  402. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_soundness.py +0 -0
  403. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_unique_join.py +0 -0
  404. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_analyze_views.py +0 -0
  405. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_connection_warnings.py +0 -0
  406. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_ir_unions.py +0 -0
  407. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_main.py +0 -0
  408. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_module_boundaries.py +0 -0
  409. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_soundness_oracle.py +0 -0
  410. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_sql_parse.py +0 -0
  411. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_sqltest.py +0 -0
  412. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/test_trino_catalog.py +0 -0
  413. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/unique_join.sqltest +0 -0
  414. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/unique_set_assertion.sqltest +0 -0
  415. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/unique_set_declaration.sqltest +0 -0
  416. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/unique_set_declaration_standalone.sqltest +0 -0
  417. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/unsupported_statements.sqltest +0 -0
  418. {sqlassert-0.3.3 → sqlassert-0.4.2}/tests/views.sqltest +0 -0
@@ -3,8 +3,8 @@ name: CI
3
3
  # Tests on every push and pull request. Publishing (see the jobs at the end)
4
4
  # happens only on a push to this repository, never on a pull request:
5
5
  # - a push to main publishes a dev build (X.Y.Z.devN) to TestPyPI;
6
- # - a tag vX.Y.Z publishes to PyPI (vX.Y.ZrcN: a pre-release, which pip
7
- # installs only with --pre) and creates a GitHub release.
6
+ # - a tag vX.Y.Z publishes the same artifacts to TestPyPI, then to PyPI
7
+ # (vX.Y.ZrcN is a pre-release), and creates a GitHub release.
8
8
  # No token is stored: PyPI trusts this workflow through OIDC (Trusted
9
9
  # Publishing), configured on pypi.org and test.pypi.org for both projects.
10
10
  on:
@@ -17,21 +17,32 @@ permissions:
17
17
  contents: read
18
18
 
19
19
  jobs:
20
- # The sqlassert package alone: dbt is never installed here.
20
+ # The sqlassert package, its tests, and the dbt plugin (the audit script imports it).
21
21
  sqlassert:
22
22
  runs-on: ubuntu-latest
23
23
  steps:
24
- - uses: actions/checkout@v4
24
+ - uses: actions/checkout@v6
25
25
  with:
26
26
  fetch-depth: 0 # setuptools-scm reads the version from git
27
- - uses: actions/setup-python@v5
27
+ - uses: actions/setup-python@v6
28
28
  with:
29
29
  python-version: "3.13"
30
- - run: pip install -e ".[test,dev]"
30
+ - run: pip install -e ".[test,dev]" -e integrations/dbt
31
31
  - run: python -m pytest -q
32
32
  - run: ty check sqlassert tests
33
33
  - run: python -m pytest --soundness-oracle -q
34
34
 
35
+ # The docs site builds with no broken link or anchor (published by pages.yml).
36
+ docs:
37
+ runs-on: ubuntu-latest
38
+ steps:
39
+ - uses: actions/checkout@v6
40
+ - uses: actions/setup-python@v6
41
+ with:
42
+ python-version: "3.13"
43
+ - run: pip install "zensical>=0.1.4"
44
+ - run: zensical build --strict
45
+
35
46
  # The dbt plugin (integrations/dbt) against this checkout's sqlassert, with
36
47
  # dbt-duckdb to compile its test project.
37
48
  dbt-plugin:
@@ -40,10 +51,10 @@ jobs:
40
51
  run:
41
52
  working-directory: integrations/dbt
42
53
  steps:
43
- - uses: actions/checkout@v4
54
+ - uses: actions/checkout@v6
44
55
  with:
45
56
  fetch-depth: 0
46
- - uses: actions/setup-python@v5
57
+ - uses: actions/setup-python@v6
47
58
  with:
48
59
  python-version: "3.13"
49
60
  - run: pip install -e ../.. -e ".[test]" ty
@@ -57,23 +68,23 @@ jobs:
57
68
  needs: [sqlassert, dbt-plugin]
58
69
  runs-on: ubuntu-latest
59
70
  steps:
60
- - uses: actions/checkout@v4
71
+ - uses: actions/checkout@v6
61
72
  with:
62
73
  fetch-depth: 0
63
- - uses: actions/setup-python@v5
74
+ - uses: actions/setup-python@v6
64
75
  with:
65
76
  python-version: "3.13"
66
77
  - run: pip install build twine
67
78
  - run: python -m build --outdir dist
68
79
  - run: python -m build --outdir dist integrations/dbt
69
80
  - run: twine check --strict dist/*
70
- - uses: actions/upload-artifact@v4
81
+ - uses: actions/upload-artifact@v7
71
82
  with:
72
83
  name: dist
73
84
  path: dist/
74
85
 
75
86
  publish-testpypi:
76
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
87
+ if: github.event_name == 'push'
77
88
  needs: build
78
89
  runs-on: ubuntu-latest
79
90
  environment:
@@ -82,17 +93,20 @@ jobs:
82
93
  permissions:
83
94
  id-token: write # OIDC token for Trusted Publishing; nothing else
84
95
  steps:
85
- - uses: actions/download-artifact@v4
96
+ - uses: actions/download-artifact@v8
86
97
  with:
87
98
  name: dist
88
99
  path: dist/
89
100
  - uses: pypa/gh-action-pypi-publish@release/v1
90
101
  with:
91
102
  repository-url: https://test.pypi.org/legacy/
103
+ # A tag's commit is often also main's head, whose push already
104
+ # uploaded this same version (setuptools-scm reads the tag).
105
+ skip-existing: true
92
106
 
93
107
  publish-pypi:
94
108
  if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
95
- needs: build
109
+ needs: publish-testpypi
96
110
  runs-on: ubuntu-latest
97
111
  environment:
98
112
  name: pypi
@@ -100,7 +114,7 @@ jobs:
100
114
  permissions:
101
115
  id-token: write
102
116
  steps:
103
- - uses: actions/download-artifact@v4
117
+ - uses: actions/download-artifact@v8
104
118
  with:
105
119
  name: dist
106
120
  path: dist/
@@ -112,7 +126,7 @@ jobs:
112
126
  permissions:
113
127
  contents: write
114
128
  steps:
115
- - uses: actions/download-artifact@v4
129
+ - uses: actions/download-artifact@v8
116
130
  with:
117
131
  name: dist
118
132
  path: dist/
@@ -1,16 +1,19 @@
1
- name: Publish interactive demo
1
+ name: Publish docs site
2
2
 
3
+ # The docs site (Zensical, from docs/site/) and the interactive demo,
4
+ # at https://polvoazul.github.io/sqlassert/ (the demo at demo.html).
3
5
  on:
4
6
  push:
5
7
  branches: [main]
6
8
  paths:
9
+ - docs/site/**
7
10
  - docs/assets/sqlassert-demo.html
8
- - docs/site/index.html
9
- - .github/workflows/demo-pages.yml
11
+ - zensical.toml
12
+ - .github/workflows/pages.yml
10
13
  workflow_dispatch:
11
14
 
12
15
  concurrency:
13
- group: demo-pages
16
+ group: pages
14
17
 
15
18
  jobs:
16
19
  deploy:
@@ -24,12 +27,13 @@ jobs:
24
27
  url: ${{ steps.deployment.outputs.page_url }}
25
28
  steps:
26
29
  - uses: actions/checkout@v6
30
+ - uses: actions/setup-python@v6
31
+ with:
32
+ python-version: "3.13"
33
+ - run: pip install "zensical>=0.1.4"
34
+ - run: zensical build --strict
35
+ - run: cp docs/assets/sqlassert-demo.html _site/demo.html
27
36
  - uses: actions/configure-pages@v5
28
- - name: Prepare demo
29
- run: |
30
- mkdir _site
31
- cp docs/site/index.html _site/index.html
32
- cp docs/assets/sqlassert-demo.html _site/demo.html
33
37
  - uses: actions/upload-pages-artifact@v4
34
38
  with:
35
39
  path: _site
@@ -1,3 +1,4 @@
1
+ .DS_Store
1
2
  .vscode
2
3
  *egg-info
3
4
  build/
@@ -6,5 +7,7 @@ tmp
6
7
  papers/
7
8
  vendor/
8
9
  __pycache__/
9
- docs/issues/mkt/
10
- docs/issues/pvt/
10
+ /docs/issues/mkt
11
+ /docs/issues/pvt
12
+ /pvt/
13
+ _site/
@@ -20,7 +20,8 @@ Whenever a connection would have helped (a table with no `CREATE`, an unknown
20
20
  column type, an ambiguous column), emit a warning Diagnostic saying what is
21
21
  missing and how to supply it, and treat the affected facts as unknown; never
22
22
  guess. With a connection (`analyze_database`), resolve it from the catalog. A
23
- connection may only add proofs, never change what the SQL alone proves.
23
+ connection may only add proofs, never change what the SQL alone proves,
24
+ and the same schema gives the same answer from the SQL or the catalog.
24
25
 
25
26
  ## Current, strict engines only
26
27
 
@@ -31,16 +32,38 @@ off), and no meaning for SQL the standard rejects but a flavor tolerates
31
32
  (a column neither grouped nor aggregated): make it opaque and warn
32
33
  `unsupported-construct`. Simpler code beats supporting outdated SQL.
33
34
 
35
+ ## Tentative dialect facts are true
36
+
37
+ Internally, do not hedge about tentative dialect facts (from docs or memory,
38
+ not yet probed). Treat them as true when designing, reviewing and
39
+ estimating risk. Users are warned that those dialects are experimental;
40
+ that is the whole of the hedge. CI probes for every dialect will exist and
41
+ will catch a wrong fact: rely on them now, before they exist.
42
+
43
+ ## Best effort on SQL the user should fix, never silently
44
+
45
+ Ambiguous or engine-dependent SQL (a name a derived table repeats) gets one
46
+ simple reading, the same for every dialect, and always a warning saying
47
+ what to change ([ADR 0008](docs/adr/0008-best-effort-on-sql-the-user-should-fix.md)).
48
+ No per-dialect variants for it. Prefer a sure reading where telling is
49
+ cheap (make the doubtful facts unknown); otherwise the reading may prove,
50
+ since the warning carries the risk. Never a silent guess. Focus effort on
51
+ the common, well-defined SQL.
52
+
34
53
  ## Where things are
35
54
 
36
55
  - Domain language: `CONTEXT.md`. Use its terms; it lists terms to avoid.
37
56
  - Implementation conventions: `docs/implementation-conventions.md`.
38
57
  - Rule style: `sqlassert/rules/STYLEGUIDE.md`.
58
+ - Functions: `sqlassert/functions/table.py` is the one place a function's
59
+ properties and result type are decided, for every dialect (docs/dialects.md,
60
+ "Function table"; issue 81).
39
61
  - Test style: SQL cases in `tests/*.sqltest` (format in `tests/sqltest.py`;
40
62
  see "Tests" in `docs/implementation-conventions.md`).
41
- - Open work: `docs/issues/` (index in `docs/issues/README.md`). Marketing
63
+ - Open work: `docs/issues/` (list in `docs/issues/list.md`). Marketing
42
64
  work is in `docs/issues/mkt/`, client work in `docs/issues/pvt/`; both are
43
- gitignored and never committed.
65
+ gitignored and never committed. Before opening, working on or closing an
66
+ issue, read `docs/issues/README.md`.
44
67
  - Architecture decisions: `docs/adr/`.
45
68
 
46
69
  ## Testing workflow
@@ -48,14 +71,17 @@ off), and no meaning for SQL the standard rejects but a flavor tolerates
48
71
  - **On each commit:** run only the focused tests for what changed (the
49
72
  `.sqltest` files and test modules it touches) and `ty check sqlassert
50
73
  tests`. No full suite, no oracle.
51
- - **At push time:** whoever pushes runs the full suite and
74
+
75
+ ## Before pushing
76
+
77
+ If user asks for 'quick push' then skip all of these.
78
+
79
+ - **Tests:** whoever pushes runs the full suite and
52
80
  `pytest --soundness-oracle` on everything not yet pushed
53
81
  (`git log @{upstream}..HEAD`), fixes any failure with that context,
54
82
  commits the fix, runs the checks below, pushes, then updates the local
55
83
  issue tracker (`tmp/issue_tracker.yaml`, rebuilt with
56
- `tmp/build_issue_tracker.py`).
57
-
58
- ## Before pushing
84
+ `tmp/build_issue_tracker.py`).
59
85
 
60
86
  The repository is public. Before every push, check that nothing private
61
87
  leaves:
@@ -22,29 +22,104 @@ Which inputs' rows a join can repeat, read in FROM order (the left input is
22
22
  everything before the join, the right its joined source). A row of one input
23
23
  appears once per matching row of the other, or once padded.
24
24
  - **Many To One Join**: no left row is repeated: each matches at most one right row.
25
- - **One To Many Join**: no right row is repeated.
25
+ - **One To Many Join**: no right row is repeated. A table function or UNNEST
26
+ in FROM whose argument reads the left input is one: it is evaluated once per
27
+ left row, so each of its rows belongs to one left row (it repeats left rows,
28
+ never right ones). One that does not read it is a cross join of unknown rows.
26
29
  - **One To One Join**: neither.
27
30
  - **Unique Join** (`UNIQUE`, `NOT MANY TO MANY`): rows of at most one input
28
31
  are repeated; the join is not many to many.
29
32
  A SEMI or ANTI join has no Join Cardinality: it outputs no right rows.
30
33
  _Avoid_: Unique join marker, duplicate check, 1:N
31
34
 
35
+ **Unproved Join Reason**:
36
+ Why a join has no proved Join Cardinality, the first that applies:
37
+ `unsupported` (an input sqlassert does not model: LATERAL, or a table function
38
+ or UNNEST whose columns are not known; or the join sits in an opaque SELECT),
39
+ `unconstrained` (no ON equality between the inputs or to a
40
+ constant: a cross or range join), `unresolved-key`, `untyped-key` (with
41
+ where the type is lost: `values`, `computed`, `opaque-relation`,
42
+ `set-operation`, `table`, `type-mismatch`), `expression-key` (every equality
43
+ compares an expression that binds no column: a deterministic function of one
44
+ input's columns binds the other's column when the comparison fixes it, and
45
+ a one-to-one function of a column (`-x`, `x + 1`, `x * 2` over exact numbers,
46
+ a cast the dialect's cast table keeps one-to-one: `CAST(n AS VARCHAR)`) binds
47
+ that column; a product of columns, a remainder, a float, a lossy cast
48
+ (`CAST(s AS INT)`), a volatile function does not),
49
+ `no-unique-set` (the bound columns reach the Row Identity of neither input),
50
+ with who can act, the first that applies: `cascade` (an input has a join with
51
+ no proved Join Cardinality or an unsupported construct below it, so fixing that
52
+ may fix this one), `partial-key` (the equalities bind part of a known Unique
53
+ Set and the rest of ON is a range or inequality: the join is as constrained as
54
+ written), `undeclared-key` (no known Unique Set covers the bound columns: one
55
+ the project could declare). A diagnostic about a missing proof, never a claim
56
+ about the data: an `unconstrained` join is not shown to be many to many.
57
+ _Avoid_: Many-to-many join (for `unconstrained`), failure reason
58
+
59
+ **Cause**:
60
+ Where an UNKNOWN assertion's Property is lost, found by following its columns
61
+ from the asserted relation through the relations they pass through
62
+ (`rules/causes`, one walk per question). For a Unique Set, a Functional
63
+ Dependency or a Join Cardinality: a join that is not many-to-one in the
64
+ direction needed (with its Unproved Join Reason), a UNION no asserted column
65
+ separates, a computed column, or a relation whose keys the columns miss (with
66
+ its closest minimal keys and what each lacks). For non-null columns: a Null
67
+ Source. For Referential Coverage: the table with no Foreign Key, or the
68
+ relation that breaks it. For an Enumerated Domain: the column with no domain,
69
+ or the source that admits a value not listed. Tagged with who can act: `sql`
70
+ (the query as written loses it), `declare` (a key, NOT NULL, Foreign Key or
71
+ domain the tables do not declare), `sqlassert` (a construct or comparison
72
+ sqlassert does not see through). Read from the analyses the proof ran: never
73
+ a Disproof, and it never changes an outcome. Every UNKNOWN assertion has one.
74
+ _Avoid_: Blame, root cause, error
75
+
32
76
  **Fan Trap**, **Chasm Trap**:
33
77
  An aggregate whose argument's rows a join may repeat (a Hazard). A Fan Trap
34
78
  is through a join that is not proved to be a Unique Join; a Chasm Trap through
35
79
  a One To Many (or Many To One) Join whose argument is on the side with one row
36
80
  per key.
37
81
 
38
- **Float Equality**:
82
+ **Exact Comparison**:
83
+ An equality `left = right` that is equal: a TRUE comparison means both sides
84
+ are the same value. Both operands have a known type and each widens,
85
+ unchanged, into the type the engine compares in
86
+ ([ADR 0007](docs/adr/0007-exact-comparisons-assume-values-in-range.md) lists
87
+ which). An unknown type is none. What an equality merges into an Equality
88
+ Group, and the domains and foreign-key coverage it moves, ask this
89
+ ([ADR 0009](docs/adr/0009-equal-and-fixing-comparisons.md)).
90
+ _Avoid_: Same type, lossless comparison
91
+
92
+ **Fixing Comparison**:
93
+ An equality `a = b` that fixes `a`: once `b`'s value is known, at most one
94
+ value of `a` makes it TRUE. An Exact Comparison is one; so is one where the
95
+ engine casts a side into the other's type keeping different values
96
+ different (the dialect's cast table, `DialectSemantics.casts`), both compared
97
+ by identity (a DATE beside a TIMESTAMP is its midnight: each fixes the other,
98
+ though they are not the same value). What an
99
+ equality binds as a join key, pins, or makes a Functional Dependency of, ask
100
+ this ([ADR 0009](docs/adr/0009-equal-and-fixing-comparisons.md)).
101
+ _Avoid_: Determining comparison
102
+
103
+ **Cast Table**:
104
+ A dialect's facts about casts between type families (`DialectSemantics.casts`,
105
+ [ADR 0011](docs/adr/0011-builtin-properties-are-functions-of-their-arguments.md)):
106
+ each cast keeps every value (widening), changes values but keeps different
107
+ ones different (injective: an integer as text, a DATE as its midnight), or
108
+ may make two values one (lossy: text read as a number, a float, narrowing).
109
+ An explicit `CAST` keeps keys and binds join keys when it is not lossy; a
110
+ comparison asks it for the side the engine casts.
111
+ _Avoid_: Injective casts, implicit cast list
112
+
113
+ **Lossy Comparison**:
39
114
  An equality comparison (`=`, `<>`, `IS [NOT] DISTINCT FROM`, an IN list or
40
- subquery) with an operand of a known floating type, REAL, FLOAT or DOUBLE
41
- in any spelling (a Hazard): floats round, so comparing one for exact
42
- equality is wrong, against another float, an integer, a decimal or a
43
- literal (`x = 0.1`). Which values a float holds exactly, and how each
44
- dialect converts the other side, are no rule to rely on. An ordering
45
- (`<`, `>`) is none, and so is an operand whose type is unknown.
46
- _Avoid_: Lossy comparison, float comparison (an ordering is fine), precision
47
- loss, rounding comparison, implicit cast (that Hazard is text)
115
+ subquery) whose operands both have a known type and that is not an Exact
116
+ Comparison because a float is on either side or because text is compared with
117
+ another type (a Hazard;
118
+ [ADR 0007](docs/adr/0007-exact-comparisons-assume-values-in-range.md) owns
119
+ the cases). An ordering (`<`, `>`) is none, and so is an operand whose type
120
+ is unknown.
121
+ _Avoid_: Float equality, implicit cast, float comparison (an ordering is fine),
122
+ precision loss, rounding comparison
48
123
 
49
124
  **Exactly One Join Assertion**:
50
125
  An assertion that every row of a join's left-hand input matches exactly one
@@ -77,16 +152,17 @@ than no marker at all.
77
152
  _Avoid_: Assertion, Property Declaration, annotation, hint
78
153
 
79
154
  **Property**:
80
- A structural semantic statement about a relation or query construct. The same
81
- Property types are used in two ways: an Assertion wraps one as a query, while a
82
- Property Declaration lists one as accepted Knowledge. A public Analysis
83
- Function evaluates a Property.
84
- _Avoid_: Rule, flag
155
+ A structural semantic statement about a relation or query construct. A
156
+ **Public Property** is user-facing: an Assertion wraps one as a query, while a
157
+ Property Declaration lists one as accepted Knowledge (Join Cardinality, Unique
158
+ Set). A **Private Property** is one the analysis derives only to prove others,
159
+ and the user never names (Exact Comparison). An Analysis Function evaluates
160
+ either kind.
161
+ _Avoid_: Rule, flag, internal fact
85
162
 
86
163
  **Analysis Function**:
87
- A computation over the semantic program that returns an Analysis Result. A
88
- public Analysis Function evaluates a Property; an internal one derives a value
89
- needed by another Analysis Function.
164
+ The implementation that evaluates a Property, Public or Private, or derives
165
+ another value, over the semantic program, returning an Analysis Result.
90
166
  _Avoid_: Rule, property
91
167
 
92
168
  **Analysis Result**:
@@ -96,8 +172,8 @@ and members rather than by a separate evidence object.
96
172
  _Avoid_: Proof, property
97
173
 
98
174
  **Result Value**:
99
- The computed value inside an Analysis Result. It can be a Boolean property
100
- answer or a derived value used only during analysis.
175
+ The computed value inside an Analysis Result: whether a Public or Private
176
+ Property holds, or another derived value.
101
177
  _Avoid_: Property, proof
102
178
 
103
179
  **Evidence**:
@@ -123,7 +199,7 @@ An explicit report that part of a SQL program could not be analyzed, such as an
123
199
  _Avoid_: Error, warning, validation failure, unknown
124
200
 
125
201
  **Connection Warning**:
126
- A Diagnostic reported apart, in `Report.warnings`, when the SQL alone lacks a fact a database connection would supply: a table with no `CREATE`, or an unqualified column more than one undeclared source may own. The affected facts are unknown; the warning names the fix. It never fails a Report, and `analyze_database` emits none ([ADR 0005](docs/adr/0005-analyze-sql-without-a-connection.md)). `Report.warnings` also carries the other facts the SQL leaves open: a key or foreign key the dialect does not enforce (`unenforced-constraint`; `RELY` or `trust_unenforced_keys`, on by default, makes it a Property Declaration, never Knowledge, and then no warning is reported), a CHECK constraint whose shape states no Enumerated Domain (`ignored-check-constraint`), a comparison of a `CAST` of a timestamp that keeps its zone (`zoned-timestamp-cast`: Trino's), a comparison of a composite column or `CAST` whose elements may be NULL (`composite-comparison`), and a proved Property that holds trivially because a column it names is always NULL (`always-null-column`, once per column: an empty Enumerated Domain satisfies every ENUM and EXHAUSTIVE, and NULL exempts a row from a Unique Set, a dependency's determinant, Referential Coverage and Non-Null Elements). The last four are about the SQL itself, so `analyze_database` keeps them.
202
+ A Diagnostic reported apart, in `Report.warnings`, when the SQL alone lacks a fact a database connection would supply: a table with no `CREATE`, or an unqualified column more than one undeclared source may own. The affected facts are unknown; the warning names the fix. It never fails a Report, and `analyze_database` emits none ([ADR 0005](docs/adr/0005-analyze-sql-without-a-connection.md)). `Report.warnings` also carries the other facts the SQL leaves open: a CHECK constraint whose shape states no Enumerated Domain (`ignored-check-constraint`), a comparison of a `CAST` of a timestamp that keeps its zone (`zoned-timestamp-cast`: Trino's), a comparison of a composite column or `CAST` whose elements may be NULL (`composite-comparison`), a name that may be one the engine gave a repeated column of a derived table (`ambiguous-duplicate-column`: DuckDB names the repeats of `k` `k_1`, `k_2`, ..., so `s.k_1` is not a real `k_1` and binds nothing), a proved Property that holds trivially because a column it names is always NULL (`always-null-column`, once per column: an empty Enumerated Domain satisfies every ENUM and EXHAUSTIVE, and NULL exempts a row from a Unique Set, a dependency's determinant, Referential Coverage and Non-Null Elements), and a function call whose result type sqlassert does not know for the dialect (`unknown-function`, where it is written: its value has no known type, so an equality on it binds nothing; a `CAST` to the type it returns fixes it). All six are about the SQL itself, so `analyze_database` keeps them; an ignored CHECK there may be one a catalog table declares.
127
203
 
128
204
  **Non-Null Elements**:
129
205
  A Property of composite columns (ARRAY, ROW, MAP): no element of a listed
@@ -227,7 +303,7 @@ database enum type, though a catalog's enum type could supply it as Knowledge.
227
303
  _Avoid_: Enum type, value set, check constraint
228
304
 
229
305
  **Equality Group**:
230
- An analysis-only set of one relation's output columns that carry the same value on every row: merged by strict equalities (`WHERE`, inner-join and semi-join `ON` `a = b`, or `a IS NOT DISTINCT FROM b`, NULL then being a shared value; a semi join's through the matched right row's columns) between known matching comparison types, never by an outer join's `ON`. Implicit casts and case-insensitive default collations (MySQL's) do not establish value identity; a `COLLATE` is unsupported. Stronger than a pair of Functional Dependencies, which an injective `a = f(b)` also satisfies. Value facts such as Enumerated Domains and Foreign Keys read it; uniqueness does not.
306
+ An analysis-only set of one relation's output columns that carry the same value on every row: merged by strict equalities (`WHERE`, inner-join and semi-join `ON` `a = b`, or `a IS NOT DISTINCT FROM b`, NULL then being a shared value; a semi join's through the matched right row's columns) that are an Exact Comparison, never by an outer join's `ON`. Implicit casts and case-insensitive default collations (MySQL's) do not establish value identity; a `COLLATE` is unsupported. Stronger than a pair of Functional Dependencies, which an injective `a = f(b)` also satisfies. Value facts such as Enumerated Domains and Foreign Keys read it; uniqueness does not.
231
307
  _Avoid_: Equivalence class, alias set
232
308
 
233
309
  **Null Source**:
@@ -247,7 +323,9 @@ A place in the SQL text where a Property Marker can be written: right before a
247
323
  JOIN, right after the last token of a Select Expression (of the whole query,
248
324
  for a set operation: its last operand ends there too, so it has none), or
249
325
  right before a simple `CASE`. Every marker attaches at one; `suggest` names each site by its
250
- line and what it marks.
326
+ line and what it marks. The Hazards of a set operation's last operand are
327
+ reported at that shared site, saying they are in the last operand of the
328
+ operator (a parenthesised last operand has a site of its own).
251
329
  _Avoid_: Marker position, anchor
252
330
 
253
331
  **Rewrite**:
@@ -255,11 +333,14 @@ A rewrite of the SQL itself, at one Attachment Site, that a Proof shows leaves
255
333
  the program's result unchanged as a multiset: an outer join that cannot keep a
256
334
  padded row written as an inner join, a join that is redundant or only filters,
257
335
  a redundant `DISTINCT` or grouping column, an unused CTE. It guarantees the
258
- same rows; a column's type or precision may change, or its arithmetic
259
- overflow, which makes it a Rewrite with Caveat.
260
- Otherwise (same rows, same column types, no new error) it is a plain
261
- Rewrite, suggestion type `rewrite`. `suggest` ranks Rewrites before Rewrites
262
- with Caveat, those before markers to paste, and those before Hazards. Every
336
+ same rows (but for the one precision case ADR 0010 accepts); a column's name,
337
+ type or precision may change, or its arithmetic overflow, which makes it a
338
+ Rewrite with Caveat.
339
+ Otherwise (same rows, same column names and types, no new error) it is a plain
340
+ Rewrite, suggestion type `rewrite`
341
+ ([ADR 0010](docs/adr/0010-what-a-rewrite-preserves.md)). `suggest` ranks
342
+ Rewrites before Rewrites with Caveat, those before markers to paste, and
343
+ those before Hazards. Every
263
344
  Rewrite is made by its Rewrite Edits, and is offered only with them.
264
345
  _Avoid_: Improvement, optimization, lint, hint
265
346
 
@@ -273,18 +354,17 @@ edits, and the equivalence tests run exactly the SQL they make.
273
354
  _Avoid_: Patch, fix, rewritten query (for the edits themselves)
274
355
 
275
356
  **Rewrite with Caveat**:
276
- A Rewrite that keeps the rows but may change an output column's type,
277
- precision or overflow, its message naming the column and the risk
278
- (suggestion type `rewrite with caveat`): a `GROUP BY` whose groups are
279
- single rows, written as a projection, replaces `sum(x)` by `x` (DuckDB's
280
- HUGEINT sum becomes x's INTEGER, and `sum(x) + 1` as `x + 1` may overflow)
281
- and `avg(b)` of a BIGINT by `b` (exact, where avg's DOUBLE may round).
282
- sqlassert has no result-type model per dialect, so precision and type
283
- differences are always a caveat, never a refusal. A replacement whose value
284
- differs otherwise (`sum` of a BOOLEAN counts it) or whose type is unknown is
285
- no Rewrite.
286
- _Avoid_: Unsafe rewrite, approximate rewrite, lossy rewrite (the rows are
287
- the same)
357
+ A Rewrite that may change an output column's name, type, precision or
358
+ overflow, its message naming the column and the risk (suggestion type
359
+ `rewrite with caveat`): a `GROUP BY` whose groups are single rows, written
360
+ as a projection, replaces `sum(x)` by `x` (DuckDB's HUGEINT sum becomes x's
361
+ INTEGER, and `sum(x) + 1` as `x + 1` may overflow) and `avg(b)` of a BIGINT
362
+ by `b` (exact, where avg's DOUBLE may round). Names, and type changes that
363
+ reach a condition, are in
364
+ [ADR 0010](docs/adr/0010-what-a-rewrite-preserves.md). A
365
+ replacement whose value differs otherwise (`sum` of a BOOLEAN counts it) or
366
+ whose type is unknown is no Rewrite.
367
+ _Avoid_: Unsafe rewrite, approximate rewrite, lossy rewrite
288
368
 
289
369
  **Implied Condition**:
290
370
  A conjunct of a WHERE or ON that the other conjuncts and the input's facts
@@ -302,8 +382,13 @@ A place whose result the SQL leaves unspecified or likely wrong, with the
302
382
  failed Proof that would have pinned it: a Fan Trap or Chasm Trap, an unmarked
303
383
  join that may be many to many, a `LIMIT`
304
384
  that picks arbitrary rows among ties, a scalar subquery that may return more
305
- than one row, a join equality that casts, an exact equality of a float
306
- (a Float Equality), a query that never returns a row.
385
+ than one row, an equality that is not an Exact Comparison, because it casts
386
+ text or involves a float (a Lossy Comparison), a CASE whose results have different types (the
387
+ common-type cast may lose information), a query that never returns a row,
388
+ a strange construct (a star beside GROUP BY, QUALIFY beside an aggregate with
389
+ no GROUP BY, a constant PARTITION BY key in any window: read from the syntax,
390
+ with no proof to fail), a select that outputs one name twice (a reference reads
391
+ only the first; the engine renames the others).
307
392
  The SQL may be what its author meant. `suggest` lists Hazards last; the
308
393
  suggestion's type (`SuggestType`) is rewrite, rewrite with caveat, marker or
309
394
  hazard.