sqlassert 0.4.1__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 (399) hide show
  1. {sqlassert-0.4.1 → sqlassert-0.4.2}/.github/workflows/ci.yml +14 -14
  2. {sqlassert-0.4.1 → sqlassert-0.4.2}/.github/workflows/pages.yml +1 -1
  3. {sqlassert-0.4.1 → sqlassert-0.4.2}/AGENTS.md +18 -4
  4. {sqlassert-0.4.1 → sqlassert-0.4.2}/CONTEXT.md +18 -5
  5. {sqlassert-0.4.1 → sqlassert-0.4.2}/PKG-INFO +18 -14
  6. {sqlassert-0.4.1 → sqlassert-0.4.2}/README.md +14 -12
  7. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/adr/0009-equal-and-fixing-comparisons.md +2 -2
  8. sqlassert-0.4.2/docs/adr/0011-builtin-properties-are-functions-of-their-arguments.md +36 -0
  9. sqlassert-0.4.2/docs/adr/0012-trust-every-declared-constraint.md +21 -0
  10. sqlassert-0.4.2/docs/adr/0013-one-function-table.md +26 -0
  11. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/assets/sqlassert-demo.html +4 -2
  12. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/calcite-audit.md +4 -3
  13. sqlassert-0.4.2/docs/dialect-provenance.json +1897 -0
  14. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/dialects.md +225 -116
  15. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/functional-dependencies.md +3 -3
  16. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/implementation-conventions.md +30 -26
  17. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0039-smaller-lowering-gaps.md +2 -2
  18. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0051-validate-snowflake-against-a-real-engine.md +2 -3
  19. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0052-validate-bigquery-against-a-real-engine.md +1 -2
  20. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0053-validate-databricks-against-a-real-engine.md +2 -3
  21. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0054-validate-redshift-against-a-real-engine.md +2 -3
  22. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0077-range-joins-against-constant-tables.md +1 -1
  23. sqlassert-0.4.2/docs/issues/0082-dbt-custom-tests-read-from-their-sql.md +92 -0
  24. sqlassert-0.4.2/docs/issues/0083-flags-to-distrust-declared-constraints-by-source.md +47 -0
  25. sqlassert-0.4.2/docs/issues/0084-clickhouse-key-semantics.md +63 -0
  26. sqlassert-0.4.2/docs/issues/done/0080-builtin-properties-as-functions-and-one-cast-table.md +86 -0
  27. sqlassert-0.4.2/docs/issues/done/0081-one-function-table.md +440 -0
  28. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/list.md +11 -2
  29. sqlassert-0.4.2/docs/site/assets/favicon.svg +1 -0
  30. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/site/codes.md +0 -1
  31. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/site/dialects.md +30 -26
  32. sqlassert-0.4.2/docs/site/functions.md +160 -0
  33. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/site/markers.md +1 -1
  34. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/site/python.md +6 -7
  35. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/README.md +5 -7
  36. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/pyproject.toml +3 -3
  37. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/__init__.py +1 -1
  38. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/__main__.py +1 -1
  39. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/connect.py +6 -8
  40. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/expectations.py +2 -11
  41. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/project.py +1 -1
  42. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/test_contracts.py +2 -14
  43. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/test_dbt.py +2 -20
  44. {sqlassert-0.4.1 → sqlassert-0.4.2}/pyproject.toml +6 -1
  45. {sqlassert-0.4.1 → sqlassert-0.4.2}/scripts/audit-new-base.md +5 -2
  46. {sqlassert-0.4.1 → sqlassert-0.4.2}/scripts/audit.py +20 -0
  47. {sqlassert-0.4.1 → sqlassert-0.4.2}/scripts/certify_dialects.py +591 -240
  48. sqlassert-0.4.2/scripts/function_table_docs.py +99 -0
  49. sqlassert-0.4.2/scripts/propose_typing.py +102 -0
  50. {sqlassert-0.4.1 → sqlassert-0.4.2}/scripts/render_sqlassert_interactive_demo.py +4 -2
  51. sqlassert-0.4.2/sqlassert/declared_types.py +158 -0
  52. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/diagnostics.py +1 -4
  53. sqlassert-0.4.2/sqlassert/dialects.py +410 -0
  54. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/discovery/bigquery.py +2 -2
  55. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/discovery/databricks.py +4 -6
  56. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/discovery/fetcher.py +22 -52
  57. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/discovery/information_schema.py +7 -10
  58. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/discovery/mysql.py +4 -8
  59. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/discovery/postgres.py +17 -26
  60. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/discovery/redshift.py +2 -2
  61. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/discovery/snowflake.py +2 -2
  62. sqlassert-0.4.2/sqlassert/functions/__init__.py +10 -0
  63. sqlassert-0.4.2/sqlassert/functions/load.py +375 -0
  64. sqlassert-0.4.2/sqlassert/functions/table.py +2721 -0
  65. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/hazards.py +1 -1
  66. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/__init__.py +13 -5
  67. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/aggregation.py +2 -3
  68. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/expressions.py +76 -67
  69. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/parser.py +0 -4
  70. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/schema.py +11 -80
  71. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/selects.py +30 -15
  72. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/shared.py +2 -3
  73. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/sources.py +2 -1
  74. sqlassert-0.4.2/sqlassert/ir/convert/value_types.py +78 -0
  75. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/model.py +331 -138
  76. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/main.py +7 -10
  77. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/causes/domain.py +1 -1
  78. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/causes/unique.py +46 -5
  79. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/domain.py +1 -1
  80. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/join_cardinality.py +14 -21
  81. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/nullability.py +3 -3
  82. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/uniqueness.py +42 -41
  83. sqlassert-0.4.2/sqlassert/rules/value_typing.py +470 -0
  84. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/suggest.py +2 -2
  85. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert.egg-info/PKG-INFO +18 -14
  86. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert.egg-info/SOURCES.txt +21 -1
  87. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert.egg-info/requires.txt +3 -1
  88. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert.egg-info/scm_file_list.json +21 -1
  89. sqlassert-0.4.2/sqlassert.egg-info/scm_version.json +8 -0
  90. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/calcite_audit_nulls.sqltest +3 -3
  91. sqlassert-0.4.2/tests/casts.sqltest +187 -0
  92. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/check_constraints.sqltest +5 -14
  93. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/computed_select_item_types.sqltest +2 -2
  94. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/dialect_mysql.sqltest +9 -24
  95. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/dialect_postgres.sqltest +13 -20
  96. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/dialect_trino.sqltest +8 -17
  97. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/dialect_warehouses.sqltest +28 -50
  98. sqlassert-0.4.2/tests/function_typing.sqltest +112 -0
  99. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/functional_dependencies_of_functions.sqltest +72 -3
  100. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/join_cardinality.sqltest +21 -3
  101. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/join_kinds_standalone.sqltest +0 -2
  102. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/not_null_rejection.sqltest +1 -1
  103. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/not_null_values.sqltest +16 -3
  104. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/soundness_oracle.py +2 -8
  105. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/sqltest.py +9 -19
  106. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/star_projection.sqltest +152 -5
  107. sqlassert-0.4.2/tests/test_audit.py +43 -0
  108. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_causes.py +1 -1
  109. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_database_hydration.py +7 -8
  110. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_dialect_certification.py +38 -15
  111. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_dialects.py +8 -23
  112. sqlassert-0.4.2/tests/test_function_docs.py +34 -0
  113. sqlassert-0.4.2/tests/test_functions.py +147 -0
  114. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_mysql_catalog.py +3 -3
  115. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_oracle_plugin.py +2 -2
  116. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_postgres_catalog.py +20 -19
  117. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_required_columns.py +1 -1
  118. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_warehouse_catalogs.py +13 -20
  119. sqlassert-0.4.2/uv.lock +576 -0
  120. {sqlassert-0.4.1 → sqlassert-0.4.2}/zensical.toml +3 -0
  121. sqlassert-0.4.1/docs/dialect-provenance.json +0 -1618
  122. sqlassert-0.4.1/sqlassert/dialects.py +0 -688
  123. sqlassert-0.4.1/sqlassert/ir/convert/builtins.py +0 -140
  124. sqlassert-0.4.1/sqlassert/ir/convert/value_types.py +0 -223
  125. sqlassert-0.4.1/sqlassert/rules/value_typing.py +0 -337
  126. sqlassert-0.4.1/sqlassert.egg-info/scm_version.json +0 -8
  127. sqlassert-0.4.1/uv.lock +0 -253
  128. {sqlassert-0.4.1 → sqlassert-0.4.2}/.gitignore +0 -0
  129. {sqlassert-0.4.1 → sqlassert-0.4.2}/CITATION.cff +0 -0
  130. {sqlassert-0.4.1 → sqlassert-0.4.2}/CLAUDE.md +0 -0
  131. {sqlassert-0.4.1 → sqlassert-0.4.2}/LICENSE +0 -0
  132. {sqlassert-0.4.1 → sqlassert-0.4.2}/case.sql +0 -0
  133. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/adr/0001-isolate-clingo-as-the-property-engine.md +0 -0
  134. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/adr/0002-use-a-framework-independent-ir.md +0 -0
  135. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/adr/0003-encode-the-ir-in-clingo.md +0 -0
  136. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/adr/0004-use-python-analysis-functions-for-property-inference.md +0 -0
  137. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/adr/0005-analyze-sql-without-a-connection.md +0 -0
  138. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/adr/0006-model-only-current-strict-engines.md +0 -0
  139. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/adr/0007-exact-comparisons-assume-values-in-range.md +0 -0
  140. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/adr/0008-best-effort-on-sql-the-user-should-fix.md +0 -0
  141. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/adr/0010-what-a-rewrite-preserves.md +0 -0
  142. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/assets/fan-trap.sql +0 -0
  143. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/assets/inner-join.sql +0 -0
  144. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/assets/redundant-join.sql +0 -0
  145. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/assets/social-preview.png +0 -0
  146. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/assets/sqlassert-demo-preview.png +0 -0
  147. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/calcite-notes.md +0 -0
  148. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0011-fuzz-test-analyze-against-a-real-world-sql-corpus.md +0 -0
  149. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0027-soundness-oracle-against-duckdb.md +0 -0
  150. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0042-lowering-support-v2.md +0 -0
  151. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0043-external-integrations.md +0 -0
  152. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0046-certify-dialect-facts.md +0 -0
  153. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0049-collation-aware-properties.md +0 -0
  154. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0057-dbt-incremental-models.md +0 -0
  155. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0058-dbt-source-mapping.md +0 -0
  156. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0059-postgres-user-defined-functions.md +0 -0
  157. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0060-audit-inference-against-cockroachdb.md +0 -0
  158. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0061-symbolic-oracle-with-verieql.md +0 -0
  159. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0062-cross-check-suggest-rewrites-with-equivalence-checkers.md +0 -0
  160. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0063-generate-random-programs-for-the-oracle.md +0 -0
  161. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0064-triage-wetune-rewrite-rules.md +0 -0
  162. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0065-triage-sqlcheck-anti-patterns.md +0 -0
  163. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0066-check-semantics-against-guagliardo-libkin.md +0 -0
  164. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0067-recheck-calcite-funcdepset.md +0 -0
  165. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0068-name-suggestion-types-by-severity.md +0 -0
  166. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0069-real-world-sql-corpora.md +0 -0
  167. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0070-decide-whether-to-warn-on-hidden-join-fanout-by-default.md +0 -0
  168. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0073-pending-lowering-and-classification-decisions.md +0 -0
  169. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0076-asof-join.md +0 -0
  170. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0078-read-casts-that-keep-a-literals-value-in-check-constraints.md +0 -0
  171. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/0079-profile-and-optimize-analysis-time.md +0 -0
  172. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/README.md +0 -0
  173. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0001-spec-rewrite-the-property-engine-around-a-relational-ir-and.md +0 -0
  174. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0002-prove-one-declared-unique-join-through-clingo.md +0 -0
  175. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0003-prove-composite-and-nullable-unique-sets.md +0 -0
  176. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0004-propagate-uniqueness-through-relation-instances-filters-and.md +0 -0
  177. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0005-analyze-cte-and-from-subquery-plans.md +0 -0
  178. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0006-expand-create-views-with-provenance-and-cycle-detection.md +0 -0
  179. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0007-derive-uniqueness-from-aggregate-and-distinct.md +0 -0
  180. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0008-derive-uniqueness-from-qualifybypartition.md +0 -0
  181. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0009-return-conservative-diagnostics-for-the-complete-mvp-boundar.md +0 -0
  182. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0010-cut-over-to-analyze-and-retire-the-legacy-analyzer.md +0 -0
  183. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0012-add-unique-set-assertions-for-select-expressions-unique-prim.md +0 -0
  184. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0013-refactoring.md +0 -0
  185. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0014-hydrate-analysis-from-database-catalogs-with-recursive-view.md +0 -0
  186. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0015-suggest-provable-properties-for-unannotated-sql.md +0 -0
  187. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0016-assert-and-declare-string-enum-domains.md +0 -0
  188. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0017-complete-typed-enum-support.md +0 -0
  189. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0018-assert-exhaustive-simple-case-expressions.md +0 -0
  190. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0019-assert-and-declare-direct-foreign-keys.md +0 -0
  191. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0020-propagate-foreign-keys-through-queries.md +0 -0
  192. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0021-assert-simple-exactly-one-joins.md +0 -0
  193. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0022-complete-exactly-one-reasoning.md +0 -0
  194. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0023-close-ir-lowering-gaps.md +0 -0
  195. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0024-functional-dependency-reasoning.md +0 -0
  196. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0025-check-rule-consistency-invariants.md +0 -0
  197. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0026-equality-groups.md +0 -0
  198. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0028-analyze-join-markers-inside-cte-bodies.md +0 -0
  199. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0029-enum-string-literals-may-coincide.md +0 -0
  200. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0030-read-enum-types-and-collations-from-the-catalog.md +0 -0
  201. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0031-enumerated-domains-through-set-operations.md +0 -0
  202. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0032-infer-simple-case-nullability.md +0 -0
  203. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0033-inner-join-suggestion-across-join-chains-and-ctes.md +0 -0
  204. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0034-close-soundness-oracle-blind-spots.md +0 -0
  205. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0035-audit-fd-propagation-against-paulley.md +0 -0
  206. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0036-refactor-tests-for-corpus-and-oracle-scale.md +0 -0
  207. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0037-close-the-paulley-audit-missing-rules.md +0 -0
  208. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0038-lower-order-by-and-select-list-subqueries.md +0 -0
  209. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0040-audit-inference-against-calcite.md +0 -0
  210. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0041-join-cardinality-markers-and-fan-trap-smell.md +0 -0
  211. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0044-v1-external-integrations.md +0 -0
  212. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0045-close-the-calcite-audit-missing-proofs.md +0 -0
  213. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0047-discovery-base-class.md +0 -0
  214. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0048-dbt-plugin-package.md +0 -0
  215. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0050-dbt-catalog-json.md +0 -0
  216. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0055-dbt-suggest-model-files.md +0 -0
  217. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0056-dbt-live-connection.md +0 -0
  218. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0070-drop-legacy-and-permissive-dialect-support.md +0 -0
  219. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0071-rewrites-carry-exact-edits.md +0 -0
  220. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0072-type-computed-select-items.md +0 -0
  221. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0074-adr-on-integer-comparisons-and-implicit-casts.md +0 -0
  222. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/issues/done/0075-make-explain-lead-to-the-cause.md +0 -0
  223. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/literature-notes.md +0 -0
  224. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/references.md +0 -0
  225. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/site/cli.md +0 -0
  226. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/site/dbt.md +0 -0
  227. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/site/index.md +0 -0
  228. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/site/proofs.md +0 -0
  229. {sqlassert-0.4.1 → sqlassert-0.4.2}/docs/site/quickstart.md +0 -0
  230. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/LICENSE +0 -0
  231. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/jinja.py +0 -0
  232. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/manifest.py +0 -0
  233. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/program.py +0 -0
  234. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/sqlassert_dbt/report.py +0 -0
  235. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/conftest.py +0 -0
  236. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/dbt_project.yml +0 -0
  237. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/active_customers.sql +0 -0
  238. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/customer_keys.sql +0 -0
  239. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/customer_orders.sql +0 -0
  240. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/customer_signups.sql +0 -0
  241. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/customers.sql +0 -0
  242. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/orders_appended.sql +0 -0
  243. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/orders_incremental.sql +0 -0
  244. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/schema.yml +0 -0
  245. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/stg_customers.sql +0 -0
  246. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/models/stg_orders.sql +0 -0
  247. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/profiles.yml +0 -0
  248. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_project/seeds/raw_payments.csv +0 -0
  249. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/dbt_runs.py +0 -0
  250. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/test_catalog.py +0 -0
  251. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/test_connect.py +0 -0
  252. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/test_file_sources.py +0 -0
  253. {sqlassert-0.4.1 → sqlassert-0.4.2}/integrations/dbt/tests/test_suggest.py +0 -0
  254. {sqlassert-0.4.1 → sqlassert-0.4.2}/join.sql +0 -0
  255. {sqlassert-0.4.1 → sqlassert-0.4.2}/left.sql +0 -0
  256. {sqlassert-0.4.1 → sqlassert-0.4.2}/poetry.lock +0 -0
  257. {sqlassert-0.4.1 → sqlassert-0.4.2}/scripts/README.md +0 -0
  258. {sqlassert-0.4.1 → sqlassert-0.4.2}/scripts/dbt_offline.py +0 -0
  259. {sqlassert-0.4.1 → sqlassert-0.4.2}/scripts/publish-pypi.sh +0 -0
  260. {sqlassert-0.4.1 → sqlassert-0.4.2}/scripts/render_sqlassert_social_preview.py +0 -0
  261. {sqlassert-0.4.1 → sqlassert-0.4.2}/scripts/vendor_dbt_analysis.py +0 -0
  262. {sqlassert-0.4.1 → sqlassert-0.4.2}/scripts/vendor_repository_inventory.py +0 -0
  263. {sqlassert-0.4.1 → sqlassert-0.4.2}/setup.cfg +0 -0
  264. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/__init__.py +0 -0
  265. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/__main__.py +0 -0
  266. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/check.py +0 -0
  267. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/discovery/__init__.py +0 -0
  268. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/discovery/duckdb.py +0 -0
  269. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/discovery/trino.py +0 -0
  270. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/edits.py +0 -0
  271. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/__init__.py +0 -0
  272. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/joins.py +0 -0
  273. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/markers.py +0 -0
  274. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/queries.py +0 -0
  275. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/scopes.py +0 -0
  276. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/subqueries.py +0 -0
  277. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/convert/windows.py +0 -0
  278. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/ir/names.py +0 -0
  279. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/properties.py +0 -0
  280. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/provenance.py +0 -0
  281. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/python_engine.py +0 -0
  282. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/reporting.py +0 -0
  283. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rewrites.py +0 -0
  284. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/STYLEGUIDE.md +0 -0
  285. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/__init__.py +0 -0
  286. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/causes/__init__.py +0 -0
  287. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/causes/coverage.py +0 -0
  288. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/causes/joins.py +0 -0
  289. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/causes/nulls.py +0 -0
  290. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/column_set.py +0 -0
  291. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/equality.py +0 -0
  292. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/exactly_one.py +0 -0
  293. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/rules/foreign_key.py +0 -0
  294. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert/sql_parse.py +0 -0
  295. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert.egg-info/dependency_links.txt +0 -0
  296. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert.egg-info/entry_points.txt +0 -0
  297. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert.egg-info/top_level.txt +0 -0
  298. {sqlassert-0.4.1 → sqlassert-0.4.2}/sqlassert_cli.py +0 -0
  299. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/aggregate_and_distinct.sqltest +0 -0
  300. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/aggregates_in_expressions.sqltest +0 -0
  301. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/always_null_columns.sqltest +0 -0
  302. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/calcite_audit.sqltest +0 -0
  303. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/calcite_audit_iq.sqltest +0 -0
  304. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/calcite_audit_keys.sqltest +0 -0
  305. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/composite_unique_sets.sqltest +0 -0
  306. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/conftest.py +0 -0
  307. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/connection_warnings.sqltest +0 -0
  308. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/cte_and_subquery.sqltest +0 -0
  309. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/database_hydration.sqltest +0 -0
  310. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/dialect_duckdb.sqltest +0 -0
  311. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/duckdb_hydration.sqltest +0 -0
  312. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/enumerated_domain.sqltest +0 -0
  313. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/enumerated_domain_standalone.sqltest +0 -0
  314. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/exact_comparisons.sqltest +0 -0
  315. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/exactly_one_join.sqltest +0 -0
  316. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/exhaustive_case.sqltest +0 -0
  317. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/fixing_comparisons.sqltest +0 -0
  318. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/foreign_keys.sqltest +0 -0
  319. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/foreign_keys_standalone.sqltest +0 -0
  320. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/functional_dependencies.sqltest +0 -0
  321. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/functional_dependencies_standalone.sqltest +0 -0
  322. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/join_kinds.sqltest +0 -0
  323. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/joins_in_bodies.sqltest +0 -0
  324. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/limit.sqltest +0 -0
  325. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/lowering_having_values_subqueries.sqltest +0 -0
  326. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/marker_accounting.sqltest +0 -0
  327. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/nested_joins.sqltest +0 -0
  328. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/not_null.sqltest +0 -0
  329. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/not_null_case_expressions.sqltest +0 -0
  330. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/not_null_standalone.sqltest +0 -0
  331. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/paulley_audit.sqltest +0 -0
  332. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/propagation.sqltest +0 -0
  333. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/qualify_by_partition.sqltest +0 -0
  334. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/recursive_cte.sqltest +0 -0
  335. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/review_soundness.sqltest +0 -0
  336. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/root_select_body.sqltest +0 -0
  337. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/scalar_aggregates.sqltest +0 -0
  338. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/scalar_subqueries.sqltest +0 -0
  339. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/schema_amendments.sqltest +0 -0
  340. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/schema_amendments_standalone.sqltest +0 -0
  341. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/set_operations.sqltest +0 -0
  342. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/set_returning_functions.sqltest +0 -0
  343. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/soundness.sqltest +0 -0
  344. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/subqueries.sqltest +0 -0
  345. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/table_functions.sqltest +0 -0
  346. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/table_functions_bigquery.sqltest +0 -0
  347. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/table_functions_databricks.sqltest +0 -0
  348. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/table_functions_postgres.sqltest +0 -0
  349. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/table_functions_redshift.sqltest +0 -0
  350. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/table_functions_spark.sqltest +0 -0
  351. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/table_functions_sqlite.sqltest +0 -0
  352. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/table_functions_trino.sqltest +0 -0
  353. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_aggregate_and_distinct.py +0 -0
  354. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_cte_and_subquery.py +0 -0
  355. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_enumerated_domain.py +0 -0
  356. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_exactly_one_join.py +0 -0
  357. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_exhaustive_case.py +0 -0
  358. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_join_cardinality.py +0 -0
  359. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_join_kinds.py +0 -0
  360. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_joins_in_bodies.py +0 -0
  361. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_marker_accounting.py +0 -0
  362. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_not_null.py +0 -0
  363. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_qualify_by_partition.py +0 -0
  364. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_scalar_subqueries.py +0 -0
  365. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_set_operations.py +0 -0
  366. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_soundness.py +0 -0
  367. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_unique_join.py +0 -0
  368. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_unique_set_assertion.py +0 -0
  369. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_analyze_views.py +0 -0
  370. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_check.py +0 -0
  371. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_connection_warnings.py +0 -0
  372. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_duckdb_hydration.py +0 -0
  373. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_equality_groups.py +0 -0
  374. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_hazards.py +0 -0
  375. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_ir_model.py +0 -0
  376. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_ir_unions.py +0 -0
  377. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_main.py +0 -0
  378. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_minimal_keys.py +0 -0
  379. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_module_boundaries.py +0 -0
  380. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_property_functions.py +0 -0
  381. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_python_engine.py +0 -0
  382. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_review_soundness.py +0 -0
  383. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_schema_sources.py +0 -0
  384. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_soundness_oracle.py +0 -0
  385. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_sql_parse.py +0 -0
  386. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_sqltest.py +0 -0
  387. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_suggest.py +0 -0
  388. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_suggest_rewrites.py +0 -0
  389. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_trino_catalog.py +0 -0
  390. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_unproved_join.py +0 -0
  391. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/test_using_star_probe.py +0 -0
  392. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/unique_join.sqltest +0 -0
  393. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/unique_set_assertion.sqltest +0 -0
  394. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/unique_set_declaration.sqltest +0 -0
  395. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/unique_set_declaration_standalone.sqltest +0 -0
  396. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/unsupported_constructs.sqltest +0 -0
  397. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/unsupported_statements.sqltest +0 -0
  398. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/values_types.sqltest +0 -0
  399. {sqlassert-0.4.1 → sqlassert-0.4.2}/tests/views.sqltest +0 -0
@@ -17,17 +17,17 @@ 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
@@ -36,8 +36,8 @@ jobs:
36
36
  docs:
37
37
  runs-on: ubuntu-latest
38
38
  steps:
39
- - uses: actions/checkout@v4
40
- - uses: actions/setup-python@v5
39
+ - uses: actions/checkout@v6
40
+ - uses: actions/setup-python@v6
41
41
  with:
42
42
  python-version: "3.13"
43
43
  - run: pip install "zensical>=0.1.4"
@@ -51,10 +51,10 @@ jobs:
51
51
  run:
52
52
  working-directory: integrations/dbt
53
53
  steps:
54
- - uses: actions/checkout@v4
54
+ - uses: actions/checkout@v6
55
55
  with:
56
56
  fetch-depth: 0
57
- - uses: actions/setup-python@v5
57
+ - uses: actions/setup-python@v6
58
58
  with:
59
59
  python-version: "3.13"
60
60
  - run: pip install -e ../.. -e ".[test]" ty
@@ -68,17 +68,17 @@ jobs:
68
68
  needs: [sqlassert, dbt-plugin]
69
69
  runs-on: ubuntu-latest
70
70
  steps:
71
- - uses: actions/checkout@v4
71
+ - uses: actions/checkout@v6
72
72
  with:
73
73
  fetch-depth: 0
74
- - uses: actions/setup-python@v5
74
+ - uses: actions/setup-python@v6
75
75
  with:
76
76
  python-version: "3.13"
77
77
  - run: pip install build twine
78
78
  - run: python -m build --outdir dist
79
79
  - run: python -m build --outdir dist integrations/dbt
80
80
  - run: twine check --strict dist/*
81
- - uses: actions/upload-artifact@v4
81
+ - uses: actions/upload-artifact@v7
82
82
  with:
83
83
  name: dist
84
84
  path: dist/
@@ -93,7 +93,7 @@ jobs:
93
93
  permissions:
94
94
  id-token: write # OIDC token for Trusted Publishing; nothing else
95
95
  steps:
96
- - uses: actions/download-artifact@v4
96
+ - uses: actions/download-artifact@v8
97
97
  with:
98
98
  name: dist
99
99
  path: dist/
@@ -114,7 +114,7 @@ jobs:
114
114
  permissions:
115
115
  id-token: write
116
116
  steps:
117
- - uses: actions/download-artifact@v4
117
+ - uses: actions/download-artifact@v8
118
118
  with:
119
119
  name: dist
120
120
  path: dist/
@@ -126,7 +126,7 @@ jobs:
126
126
  permissions:
127
127
  contents: write
128
128
  steps:
129
- - uses: actions/download-artifact@v4
129
+ - uses: actions/download-artifact@v8
130
130
  with:
131
131
  name: dist
132
132
  path: dist/
@@ -27,7 +27,7 @@ jobs:
27
27
  url: ${{ steps.deployment.outputs.page_url }}
28
28
  steps:
29
29
  - uses: actions/checkout@v6
30
- - uses: actions/setup-python@v5
30
+ - uses: actions/setup-python@v6
31
31
  with:
32
32
  python-version: "3.13"
33
33
  - run: pip install "zensical>=0.1.4"
@@ -32,6 +32,14 @@ off), and no meaning for SQL the standard rejects but a flavor tolerates
32
32
  (a column neither grouped nor aggregated): make it opaque and warn
33
33
  `unsupported-construct`. Simpler code beats supporting outdated SQL.
34
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
+
35
43
  ## Best effort on SQL the user should fix, never silently
36
44
 
37
45
  Ambiguous or engine-dependent SQL (a name a derived table repeats) gets one
@@ -47,6 +55,9 @@ the common, well-defined SQL.
47
55
  - Domain language: `CONTEXT.md`. Use its terms; it lists terms to avoid.
48
56
  - Implementation conventions: `docs/implementation-conventions.md`.
49
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).
50
61
  - Test style: SQL cases in `tests/*.sqltest` (format in `tests/sqltest.py`;
51
62
  see "Tests" in `docs/implementation-conventions.md`).
52
63
  - Open work: `docs/issues/` (list in `docs/issues/list.md`). Marketing
@@ -60,14 +71,17 @@ the common, well-defined SQL.
60
71
  - **On each commit:** run only the focused tests for what changed (the
61
72
  `.sqltest` files and test modules it touches) and `ty check sqlassert
62
73
  tests`. No full suite, no oracle.
63
- - **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
64
80
  `pytest --soundness-oracle` on everything not yet pushed
65
81
  (`git log @{upstream}..HEAD`), fixes any failure with that context,
66
82
  commits the fix, runs the checks below, pushes, then updates the local
67
83
  issue tracker (`tmp/issue_tracker.yaml`, rebuilt with
68
- `tmp/build_issue_tracker.py`).
69
-
70
- ## Before pushing
84
+ `tmp/build_issue_tracker.py`).
71
85
 
72
86
  The repository is public. Before every push, check that nothing private
73
87
  leaves:
@@ -42,8 +42,10 @@ where the type is lost: `values`, `computed`, `opaque-relation`,
42
42
  `set-operation`, `table`, `type-mismatch`), `expression-key` (every equality
43
43
  compares an expression that binds no column: a deterministic function of one
44
44
  input's columns binds the other's column when the comparison fixes it, and
45
- an injective one of a column (`-x`, `x + 1`) binds that column; a product, a
46
- float, a cast to another type, a volatile function does not),
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),
47
49
  `no-unique-set` (the bound columns reach the Row Identity of neither input),
48
50
  with who can act, the first that applies: `cascade` (an input has a join with
49
51
  no proved Join Cardinality or an unsupported construct below it, so fixing that
@@ -91,12 +93,23 @@ _Avoid_: Same type, lossless comparison
91
93
  An equality `a = b` that fixes `a`: once `b`'s value is known, at most one
92
94
  value of `a` makes it TRUE. An Exact Comparison is one; so is one where the
93
95
  engine casts a side into the other's type keeping different values
94
- different, both compared by identity (a DATE beside a TIMESTAMP is its
95
- midnight: each fixes the other, though they are not the same value). What an
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
96
99
  equality binds as a join key, pins, or makes a Functional Dependency of, ask
97
100
  this ([ADR 0009](docs/adr/0009-equal-and-fixing-comparisons.md)).
98
101
  _Avoid_: Determining comparison
99
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
+
100
113
  **Lossy Comparison**:
101
114
  An equality comparison (`=`, `<>`, `IS [NOT] DISTINCT FROM`, an IN list or
102
115
  subquery) whose operands both have a known type and that is not an Exact
@@ -186,7 +199,7 @@ An explicit report that part of a SQL program could not be analyzed, such as an
186
199
  _Avoid_: Error, warning, validation failure, unknown
187
200
 
188
201
  **Connection Warning**:
189
- 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`), 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 seven are about the SQL itself, so `analyze_database` keeps them: an unenforced constraint there is one a `CREATE TABLE` declares, in the SQL or, for a catalog table's CHECK, in its declaration (a catalog key's warning comes from the catalog binding).
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.
190
203
 
191
204
  **Non-Null Elements**:
192
205
  A Property of composite columns (ARRAY, ROW, MAP): no element of a listed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlassert
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Asserts and static proofs for your SQL, without touching your data.
5
5
  Author: Fred Israel
6
6
  License-Expression: MIT
@@ -19,10 +19,12 @@ Requires-Python: >=3.13
19
19
  Description-Content-Type: text/markdown
20
20
  License-File: LICENSE
21
21
  Requires-Dist: case-conversion>=3.0.2
22
- Requires-Dist: sqlglot<31,>=30.30
22
+ Requires-Dist: sqlglot<30.34,>=30.33
23
23
  Provides-Extra: test
24
24
  Requires-Dist: duckdb>=2.0; extra == "test"
25
25
  Requires-Dist: hypothesis; extra == "test"
26
+ Requires-Dist: markdown-it-py; extra == "test"
27
+ Requires-Dist: pyyaml; extra == "test"
26
28
  Requires-Dist: pytest; extra == "test"
27
29
  Requires-Dist: pytest-xdist; extra == "test"
28
30
  Provides-Extra: dev
@@ -31,6 +33,8 @@ Provides-Extra: docs
31
33
  Requires-Dist: zensical>=0.1.4; extra == "docs"
32
34
  Dynamic: license-file
33
35
 
36
+ <img src="https://raw.githubusercontent.com/polvoazul/sqlassert/main/docs/site/assets/favicon.svg" width="72" alt="sqlassert logo">
37
+
34
38
  # sqlassert
35
39
 
36
40
  [![PyPI version](https://img.shields.io/pypi/v/sqlassert)](https://pypi.org/project/sqlassert/)
@@ -173,7 +177,7 @@ Proved tests are passed to `dbt build` as `--exclude`, so they never run. See [s
173
177
  ## What it proves
174
178
 
175
179
  | Assertion | Marker | Guards against | `DECLARE` form |
176
- |---|---|---|---|
180
+ |---|---|---|
177
181
  | [Join cardinality](https://polvoazul.github.io/sqlassert/markers/#join-cardinality) | `UNIQUE`, `MANY TO ONE`, `ONE TO MANY`, `ONE TO ONE` before a join | row multiplication | – |
178
182
  | [Exactly One Join](https://polvoazul.github.io/sqlassert/markers/#exactly-one-join) | `EXACTLY ONE` before a join | rows multiplied *or dropped*; a LEFT JOIN that pads | – |
179
183
  | [Unique Set](https://polvoazul.github.io/sqlassert/markers/#unique-set-and-non-null-unique-set) | `UNIQUE(cols)`, `NOT NULL UNIQUE(cols)`, `PRIMARY KEY(cols)` | duplicate keys, wrong grain | yes |
@@ -194,23 +198,23 @@ Every marker is a SQL comment (`/**ASSERT ...**/`), so annotated SQL still runs
194
198
  | [`sqlassert suggest`](https://polvoazul.github.io/sqlassert/cli/#sqlassert-suggest) | Lists provable markers, proved rewrites, and hazards (fan traps, chasm traps, arbitrary LIMIT, ...). |
195
199
  | [`sqlassert-dbt`](https://github.com/polvoazul/sqlassert/tree/main/integrations/dbt#readme) | Checks a dbt project from its manifest and skips the tests the SQL proves. |
196
200
 
197
- | Dialect | Key constraints | Catalog fetcher | Support |
198
- |---|---|---|---|
199
- | DuckDB | enforced | yes | high, plus the soundness oracle |
200
- | PostgreSQL | enforced | yes | low |
201
- | MySQL 8.4+ (strict `sql_mode`) | enforced | yes | low |
202
- | Snowflake | unenforced, `RELY` | yes | low |
203
- | BigQuery | unenforced | yes | low |
204
- | Databricks / Spark | unenforced, `RELY` | yes | low |
205
- | Redshift | unenforced | yes | low |
206
- | Trino | none | yes (NOT NULL only) | low |
201
+ | Dialect | Catalog fetcher | Support |
202
+ |---|---|---|
203
+ | DuckDB | yes | high, plus the soundness oracle |
204
+ | PostgreSQL | yes | low |
205
+ | MySQL 8.4+ (strict `sql_mode`) | yes | low |
206
+ | Snowflake | yes | low |
207
+ | BigQuery | yes | low |
208
+ | Databricks / Spark | yes | low |
209
+ | Redshift | yes | low |
210
+ | Trino | yes (NOT NULL only) | low |
207
211
 
208
212
  A low-support dialect has dialect facts written from memory and not yet
209
213
  probed on the engine, so its analysis can contain mistakes: a PROVED
210
214
  assertion there can be wrong. A dialect with no such fact is high support
211
215
  (DuckDB, SQLite); see [Support levels](https://github.com/polvoazul/sqlassert/blob/main/docs/dialects.md#support-levels).
212
216
 
213
- Unenforced keys are trusted as declarations by default; `trust_unenforced_keys=False` keeps only those marked `RELY` (see [Dialects](https://polvoazul.github.io/sqlassert/dialects/)).
217
+ Every declared key, foreign key and CHECK is trusted, whether or not the engine enforces it: Snowflake, BigQuery, Databricks and Redshift keys prove what they state (see [Dialects](https://polvoazul.github.io/sqlassert/dialects/)).
214
218
 
215
219
  ## Documentation
216
220
 
@@ -1,3 +1,5 @@
1
+ <img src="https://raw.githubusercontent.com/polvoazul/sqlassert/main/docs/site/assets/favicon.svg" width="72" alt="sqlassert logo">
2
+
1
3
  # sqlassert
2
4
 
3
5
  [![PyPI version](https://img.shields.io/pypi/v/sqlassert)](https://pypi.org/project/sqlassert/)
@@ -140,7 +142,7 @@ Proved tests are passed to `dbt build` as `--exclude`, so they never run. See [s
140
142
  ## What it proves
141
143
 
142
144
  | Assertion | Marker | Guards against | `DECLARE` form |
143
- |---|---|---|---|
145
+ |---|---|---|
144
146
  | [Join cardinality](https://polvoazul.github.io/sqlassert/markers/#join-cardinality) | `UNIQUE`, `MANY TO ONE`, `ONE TO MANY`, `ONE TO ONE` before a join | row multiplication | – |
145
147
  | [Exactly One Join](https://polvoazul.github.io/sqlassert/markers/#exactly-one-join) | `EXACTLY ONE` before a join | rows multiplied *or dropped*; a LEFT JOIN that pads | – |
146
148
  | [Unique Set](https://polvoazul.github.io/sqlassert/markers/#unique-set-and-non-null-unique-set) | `UNIQUE(cols)`, `NOT NULL UNIQUE(cols)`, `PRIMARY KEY(cols)` | duplicate keys, wrong grain | yes |
@@ -161,23 +163,23 @@ Every marker is a SQL comment (`/**ASSERT ...**/`), so annotated SQL still runs
161
163
  | [`sqlassert suggest`](https://polvoazul.github.io/sqlassert/cli/#sqlassert-suggest) | Lists provable markers, proved rewrites, and hazards (fan traps, chasm traps, arbitrary LIMIT, ...). |
162
164
  | [`sqlassert-dbt`](https://github.com/polvoazul/sqlassert/tree/main/integrations/dbt#readme) | Checks a dbt project from its manifest and skips the tests the SQL proves. |
163
165
 
164
- | Dialect | Key constraints | Catalog fetcher | Support |
165
- |---|---|---|---|
166
- | DuckDB | enforced | yes | high, plus the soundness oracle |
167
- | PostgreSQL | enforced | yes | low |
168
- | MySQL 8.4+ (strict `sql_mode`) | enforced | yes | low |
169
- | Snowflake | unenforced, `RELY` | yes | low |
170
- | BigQuery | unenforced | yes | low |
171
- | Databricks / Spark | unenforced, `RELY` | yes | low |
172
- | Redshift | unenforced | yes | low |
173
- | Trino | none | yes (NOT NULL only) | low |
166
+ | Dialect | Catalog fetcher | Support |
167
+ |---|---|---|
168
+ | DuckDB | yes | high, plus the soundness oracle |
169
+ | PostgreSQL | yes | low |
170
+ | MySQL 8.4+ (strict `sql_mode`) | yes | low |
171
+ | Snowflake | yes | low |
172
+ | BigQuery | yes | low |
173
+ | Databricks / Spark | yes | low |
174
+ | Redshift | yes | low |
175
+ | Trino | yes (NOT NULL only) | low |
174
176
 
175
177
  A low-support dialect has dialect facts written from memory and not yet
176
178
  probed on the engine, so its analysis can contain mistakes: a PROVED
177
179
  assertion there can be wrong. A dialect with no such fact is high support
178
180
  (DuckDB, SQLite); see [Support levels](https://github.com/polvoazul/sqlassert/blob/main/docs/dialects.md#support-levels).
179
181
 
180
- Unenforced keys are trusted as declarations by default; `trust_unenforced_keys=False` keeps only those marked `RELY` (see [Dialects](https://polvoazul.github.io/sqlassert/dialects/)).
182
+ Every declared key, foreign key and CHECK is trusted, whether or not the engine enforces it: Snowflake, BigQuery, Databricks and Redshift keys prove what they state (see [Dialects](https://polvoazul.github.io/sqlassert/dialects/)).
181
183
 
182
184
  ## Documentation
183
185
 
@@ -1,6 +1,6 @@
1
1
  # Equal and fixing comparisons
2
2
 
3
- Extends [ADR 0007](0007-exact-comparisons-assume-values-in-range.md). Code: `exact_comparison` and `fixes` in `sqlassert/rules/value_typing.py`, facts in `DialectSemantics.injective_casts`.
3
+ Extends [ADR 0007](0007-exact-comparisons-assume-values-in-range.md). Code: `exact_comparison` and `fixes` in `sqlassert/rules/value_typing.py`, facts in the dialect's cast table, `DialectSemantics.casts` ([ADR 0011](0011-builtin-properties-are-functions-of-their-arguments.md)).
4
4
 
5
5
  ## The question
6
6
 
@@ -64,7 +64,7 @@ Rule 2 needs its own word. Refusing it leaves the join UNKNOWN; calling it equal
64
64
 
65
65
  Widenings are what `exact_comparison` already admits (ADR 0007), plus one general fact: a date or time type's precision parameter does not change its comparison type, so `TIMESTAMP(3)` and `TIMESTAMP(6)` are one type in every dialect.
66
66
 
67
- Injective casts are `DialectSemantics.injective_casts`: pairs `(T, U)` where comparing a T with a U casts the T to U, injectively. Today they are all a DATE to its midnight. Each is certified as `injective_cast(T->U)`: the date equals its midnight, and does not equal a later time that day (which an engine casting the timestamp down to a DATE would match). Probed on DuckDB; tentative from memory elsewhere.
67
+ Which kind each cast is now comes from one cast table per dialect, `DialectSemantics.casts` ([ADR 0011](0011-builtin-properties-are-functions-of-their-arguments.md)), which an explicit CAST asks too. A comparison asks it for the side it casts: the narrower within a family, else the earlier of date, timestamp, zoned timestamp (or of integer, decimal, float), and text beside anything else. Injective ones in comparisons are all a DATE to its midnight, the table's `("date", "timestamp")` and `("date", "timestamptz")` entries. Each is certified as `cast(date->timestamp)=injective`: distinct dates stay distinct, the date equals its midnight, and does not equal a later time that day (which an engine casting the timestamp down to a DATE would match). Probed on DuckDB; tentative from memory elsewhere. A target that keeps the zone does not compare by identity, so it fixes nothing whatever the table says.
68
68
 
69
69
  | Dialect | DATE is cast injectively to | Not, and why |
70
70
  |---|---|---|
@@ -0,0 +1,36 @@
1
+ # Builtin properties are functions of their arguments
2
+
3
+ Extends [ADR 0009](0009-equal-and-fixing-comparisons.md); extended by [ADR 0013](0013-one-function-table.md). Code: `ir.Builtin` and `ir.CallProperties` in `sqlassert/ir/model.py`, the function table in `sqlassert/functions/table.py`, facts in `DialectSemantics.casts`.
4
+
5
+ ## The question
6
+
7
+ `SELECT CAST(id AS VARCHAR) AS k FROM t`, with `id VARCHAR PRIMARY KEY`, is unique in `k`. Before this ADR sqlassert said UNKNOWN, while plain `SELECT id AS k` was PROVED, and a join `ON CAST(t.id AS VARCHAR) = f.tid` bound nothing. Yet `d_date = ts`, where the engine casts the DATE itself, bound as a join key (ADR 0009). One fact, "the cast T→U keeps different values different", was answered yes for an implicit cast and no for the same cast written out.
8
+
9
+ The cause: a Builtin's properties (`strict`, `total`, `injective`) were constants per function. A cast's injectivity depends on its source and target types, so its constant had to be the safe `False`. `+` is injective only over exact numerics, so its type condition leaked into three rule sites as an `exact_numeric` gate beside `injective_input`.
10
+
11
+ ## Two properties keys need
12
+
13
+ For a scalar `f` from typed inputs to a typed output, each relative to the equality its type compares by:
14
+
15
+ - **Respects equality**: `a = b` implies `f(a) = f(b)`. Functional Dependencies need it. `upper(x)` under a case-insensitive collation does not.
16
+ - **Reflects equality** (injective): `f(a) = f(b)` implies `a = b`. Keys through a projection, `GROUP BY` determinants and join key binding need it ("fixes" in ADR 0009).
17
+
18
+ Both depend on the arguments' types and on the dialect, never on the function's name alone.
19
+
20
+ ## The decision
21
+
22
+ 1. **A Builtin's properties are a function of its arguments.** It receives one summary per argument (its derived `ValueTyping`, its literal value when constant, the type when the argument is a type, as CAST's target is), the result's typing and the dialect, and returns `CallProperties`: per argument `strict`, `total`, `respects`, `reflects`, and a reason for explanations. A Builtin whose properties really are constant uses a constant function.
23
+ 2. **The function sees summaries, not subtrees.** Recursion stays in the generic walkers (`determinants`, `strict_inputs`, `total`, the reflecting input of an expression), so each Builtin's function is a few pure lines.
24
+ 3. **Types come from the rules.** The walkers call property functions where typings are derived (`rules/value_typing.py`), and the reason joins the proof's explanation.
25
+ 4. **Unknown means false.** An unknown type or literal gives no property beyond the sound defaults.
26
+ 5. **One cast table per dialect.** `DialectSemantics.casts` classifies each pair of type families with ADR 0009's three kinds: widening (values unchanged), injective (values change, distinct stay distinct), lossy. Family rules cover most pairs (an integer into a wider integer, an integer into a decimal with room, text into unsized text); per-dialect entries cover the rest (Postgres truncates `varchar(n)`). An explicit CAST asks it; so does an implicit cast in a comparison, for the side the engine casts (the narrower within a family, else the earlier of date, timestamp, zoned timestamp or of integer, decimal, float; text beside anything else), the cast's kind being the dialect's. `ValueTyping.casts_to` and `DialectSemantics.injective_casts` fold into it.
27
+ 6. **No special case in lowering.** A cast to the same type stays an `ir.Call`; its properties say it is the identity, and explanations still show the cast the user wrote.
28
+
29
+ ## Consequences
30
+
31
+ - `CAST(id AS TEXT)`, `CAST(n AS BIGINT)`, `n * 2`, `CAST(d AS TIMESTAMP)` keep keys and bind join keys wherever they are written: SELECT, ON, WHERE, GROUP BY.
32
+ - `%`'s totality reads its divisor literal; `round(x, k)` and `date_trunc` may later read theirs.
33
+ - Every cast-table entry is a dialect fact: certified by a probe (`count(distinct x)` against `count(distinct cast(x AS U))` over values chosen to break it), tentative elsewhere until probed.
34
+ - Functional Dependencies of computed columns read `respects` (`value_typing.respects_equality`): a pure function of inputs compared by identity respects equality; past that, only where the call's property function says so (arithmetic over floats, a widening CAST) or the node clearly does (IS NULL, AND/OR, comparisons, COALESCE and simple CASE over values that compare alike). `upper` under MySQL's accent-insensitive default collation does not: 'é' = 'e', but upper('é') <> upper('e').
35
+ - An UNKNOWN key names the call where the reflecting walk stops, with its property function's reason: `CAST(s AS INT): a cast from VARCHAR to INT may make two values one (text like '01' and '1' becomes one number)`.
36
+ - Nullability of an argument is not part of its summary: `total` composes it generically, and no Builtin needs more yet.
@@ -0,0 +1,21 @@
1
+ # Trust every declared constraint
2
+
3
+ A declared constraint is Knowledge in every dialect, whether or not the database checks it. This covers a PRIMARY KEY, UNIQUE, FOREIGN KEY, CHECK, NOT NULL or unique index, written in the SQL or read from a catalog. Some constraints the engine never checks: keys in Snowflake, BigQuery, Redshift and Databricks, foreign keys in SQLite without the pragma or in a MyISAM table, constraints in Trino or ClickHouse SQL, and anything marked `NOT ENFORCED`, `NOT VALID` or `DEFERRABLE`. Each still proves what it states, exactly as it would where the engine checks it, and none of them warns.
4
+
5
+ The alternative was to model enforcement, and sqlassert did until this decision:
6
+
7
+ - a per-dialect trust level for keys, foreign keys and CHECKs (enforced, `RELY` or unenforced);
8
+ - a `trust_unenforced_keys` option, on by default, through the API, CLI and dbt plugin;
9
+ - an `unenforced-constraint` warning;
10
+ - special cases for `RELY`, `NOT ENFORCED`, `NOT VALID`, `DEFERRABLE`, MySQL storage engines and column-level `REFERENCES`;
11
+ - certifier probes for each of these, and a matching per-adapter table in the dbt plugin.
12
+
13
+ The option was on by default, so nearly every user already got these proofs. All that machinery bought was an opt-out few would use, at a cost every later change paid. The person who declares a constraint is the one who knows whether the data satisfies it, as with a `/**DECLARE ...**/` marker.
14
+
15
+ ## Consequences
16
+
17
+ - Where a database does not check a constraint, data can violate it, and a proof that rests on it is then wrong. That risk belongs to whoever declared the constraint. sqlassert does not warn about it.
18
+ - The SQL and the catalog agree ([ADR 0005](0005-analyze-sql-without-a-connection.md)). The catalog fetchers read every declared constraint, with no filter on validated, enforced or deferrable.
19
+ - What a constraint means still varies by dialect, and that is still modelled. A SQLite PRIMARY KEY does not make its columns NOT NULL (`primary_key_not_null`). A CHECK proves only in the shapes sqlassert reads.
20
+ - Whether a constraint applies at all is also still checked. A dbt contract constraint counts only when the contract is enforced and the model is materialized as a table, because otherwise dbt never declares it. A Postgres table that other tables inherit from keeps its columns only, because it returns its children's rows too.
21
+ - Issue 83 tracks bringing back a way to turn off trust for particular constraint sources.
@@ -0,0 +1,26 @@
1
+ # One function table
2
+
3
+ Extends [ADR 0011](0011-builtin-properties-are-functions-of-their-arguments.md). Code: `sqlassert/functions/` (`table.py` the data, `load.py` the loader), `ir.Builtin.typing` in `sqlassert/ir/model.py`. Issue 81.
4
+
5
+ ## The question
6
+
7
+ What sqlassert knew of one function was spread over six places that did not know of each other: the Builtins' properties, per-dialect switches for them, a fixed result type, a result type that follows an argument, arithmetic and CAST typing, and the certifier's probe inputs. `floor` was a Builtin no dialect gave a result type, so `floor(x)` was untyped in all of them and nothing noticed. A function could be typed without being a Builtin, and a Builtin could have no type.
8
+
9
+ ## Decision
10
+
11
+ - **The table is data.** `sqlassert/functions/table.py` holds one `Function` per SQLGlot node (`Anonymous:<name>` for one SQLGlot does not know), never one per spelling: SQLGlot already turns each dialect's spelling into a node. An entry has a property function (or `PER_DIALECT`, or `VOLATILE`), its `signatures` (argument keys and arity tell apart one node that is two functions, `date(ts)` and `date(y, m, d)`), an example, and **a required keyword per modelled dialect** giving the result type. A missing keyword is an error for the type checker and at import, so every dialect is decided explicitly. There are no defaults, no complement sets and no inheritance.
12
+ - **The typing vocabulary is small and names every argument index:** a string (a fixed type, in the dialect's spelling), `keep(i)`, `family(i)`, `on_arg(i, {family: ...}, otherwise=...)`, `on_literal(key, {...}, otherwise=...)`, `on_arity({n: ...}, otherwise=...)`, `common(...)`, `target`, `UNREACHABLE`, `ABSENT`, `UNDECIDED`, `unmodelled(Reason.X)`. Shorthands (`PROMOTED` for arithmetic, `POSTGRES_MATH`) are constants built from these, never new primitives.
13
+ - **Typing is part of the Builtin.** `Builtin.typing(arguments)` returns a type and a reason; `scalar_typing(Call)` asks it, so a type in a proof explains itself. A CAST's target is captured in a Builtin built for its call site, so `Call.arguments` stay values and no walker learns an argument of kind type. This narrows ADR 0011's "the type when the argument is a type".
14
+ - **`Call` absorbs `OpaquePureFunction`.** Every application of a pure function is a `Call`: modelled, or to a `CONSERVATIVE` Builtin named after the function (strictness and totality unknown, respects equality in identity arguments only, reflects none). A searched CASE or IF is a Builtin typed with `common` over its result positions. Purity stays a split between node types, `Call` and `OpaqueExpression`, exhaustive under `assert_never`, not a flag; a `VOLATILE` entry (`now()`, `random()`, `current_date`) has a type but lowers to an `OpaqueExpression` carrying it.
15
+ - **`UNDECIDED` is a ratchet.** The type checker forces naming a keyword, not deciding it, so `UNDECIDED` is kept apart from `unmodelled(Reason.X)` (looked at, not modelled, and why), and a test pins the number of `UNDECIDED` keywords; it may only fall. It is zero today.
16
+ - **`UNREACHABLE` and `ABSENT` are two checked claims.** `UNREACHABLE`: no SQL of the dialect lowers to the node (SQLGlot has no spelling of it, or reads it as another node); a test checks the example is not the node there, and is the node in every other dialect. `ABSENT`: the dialect's SQL is the node, but the engine has no such function; the certifier's `absent(Node)` probe checks the engine rejects the call. Either way any type claimed would be vacuous.
17
+ - **The certifier fails fast.** Only an engine rejecting an argument type at bind time (narrowly matched messages) or a missing function (`absent`) is an expected error; a fixture, spelling or value the engine cannot take is declared by name per dialect (`_NO_FIXTURE`, `_NO_GRID`, `_GRID_VALUES`, `_ABSENT_ERRORS`), and any other error fails the probe.
18
+ - **`Builtin.modelled` only drives explanations.** It is false for a conservative or CASE/IF Builtin, and selects the "sqlassert does not model it" reasons and `not-modelled` cause steps the opaque node had. No rule reads it for a proof.
19
+ - **Typings are hand-kept and tested, with no lockfile.** Every keyword is written in the table, DuckDB's proposed by `scripts/propose_typing.py` from the in-process engine. The certifier's grid (one fixture per `ir.TypeFamily`) probes them: `typeof(f(x))`, and, wherever a property function claims `reflects` or `respects`, `count(DISTINCT x) = count(DISTINCT f(x))` over the family's values and `f(x) = f(y)` over values that compare equal. Provenance is one record per function and dialect, as weak as its weakest fact, with the families probed and rejected; the status is bookkeeping for the "experimental" warning, never a reason to claim less. The Markdown function table on the docs site is generated from the entries.
20
+
21
+ ## Consequences
22
+
23
+ - Adding a function is one entry; adding a dialect is a new required keyword, an error in every entry until each is decided.
24
+ - A function with no type warns `unknown-function` where it is written, and `scripts/audit.py` ranks those by count to say what to add next.
25
+ - A dialect not listed in `dialects.py` decides nothing: its entries are `UNDECIDED`, so it loses arithmetic, NULLIF and TRY_CAST typing.
26
+ - A function whose result is a composite stays `unmodelled`: a `ValueTyping` has no composite type.
@@ -3,10 +3,12 @@
3
3
  <meta charset="utf-8">
4
4
  <meta name="viewport" content="width=device-width, initial-scale=1">
5
5
  <title>sqlassert interactive demo</title>
6
+ <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><rect width='64' height='64' rx='14' fill='%230f172a'/><path d='M14 18v28c0 5 8 9 18 9s18-4 18-9V18' fill='%231e40af'/><ellipse cx='32' cy='18' rx='18' ry='8' fill='%233b82f6'/><path d='M22 37l7 7 13-14' fill='none' stroke='%23a7f3d0' stroke-width='6' stroke-linecap='round' stroke-linejoin='round'/></svg>">
6
7
  <style>
7
8
  :root { color-scheme: dark; font-family: system-ui, sans-serif; background: #0b1119; color: #edf5fc; }
8
9
  body { max-width: 80rem; margin: 0 auto; padding: clamp(1rem, 4vw, 3rem); }
9
- h1 { margin: 0 0 .4rem; font-size: 2.6rem; }
10
+ h1 { margin: 0 0 .4rem; font-size: 2.6rem; display: flex; align-items: center; gap: .5rem; }
11
+ .mark { flex: none; }
10
12
  header p { margin: 0 0 1.8rem; color: #b0c1d3; }
11
13
  nav, footer { display: flex; flex-wrap: wrap; gap: .6rem; }
12
14
  footer { justify-content: space-between; margin-top: 1.15rem; }
@@ -30,7 +32,7 @@ mark { color: #ffdb9e; background: #3d3022; border-left: 3px solid #ffc979; padd
30
32
  .removed { color: #ff9eaa; }
31
33
  @media (max-width: 52rem) { .columns { grid-template-columns: 1fr; } }
32
34
  </style>
33
- <header><h1>sqlassert</h1><p>Simplify and catch SQL bugs before they ship</p></header>
35
+ <header><h1><svg class="mark" viewBox="0 0 64 64" width="2.6rem" height="2.6rem" aria-hidden="true"><rect width="64" height="64" rx="14" fill="#0f172a"/><path d="M14 18v28c0 5 8 9 18 9s18-4 18-9V18" fill="#1e40af"/><ellipse cx="32" cy="18" rx="18" ry="8" fill="#3b82f6"/><path d="M22 37l7 7 13-14" fill="none" stroke="#a7f3d0" stroke-width="6" stroke-linecap="round" stroke-linejoin="round"/></svg> sqlassert</h1><p>Simplify and catch SQL bugs before they ship</p></header>
34
36
  <nav aria-label="Choose an example"><button type="button" aria-controls="step-0" aria-pressed="true">Fan Trap</button><button type="button" aria-controls="step-1" aria-pressed="false">INNER JOIN</button><button type="button" aria-controls="step-2" aria-pressed="false">Redundant Join</button><button type="button" aria-controls="step-3" aria-pressed="false">Annotate</button></nav>
35
37
  <main><section id="step-0" aria-labelledby="title-0"><h2 id="title-0">Fan Trap</h2><p>Multiple refunds can make the same payment count more than once.</p><div class="columns"><div class="panel"><h3>fan-trap.sql</h3><pre><span class="line"><span class="number" aria-hidden="true">1</span><span>CREATE TABLE orders (id INT PRIMARY KEY);</span></span><span class="line"><span class="number" aria-hidden="true">2</span><span>CREATE TABLE payments (id INT PRIMARY KEY, order_id INT, amount INT);</span></span><span class="line"><span class="number" aria-hidden="true">3</span><span>CREATE TABLE refunds (id INT PRIMARY KEY, order_id INT);</span></span><span class="line"><span class="number" aria-hidden="true">4</span><span> </span></span><span class="line"><span class="number" aria-hidden="true">5</span><span>SELECT o.id, SUM(p.amount) AS paid</span></span><span class="line"><span class="number" aria-hidden="true">6</span><span>FROM orders o</span></span><mark class="line"><span class="number" aria-hidden="true">7</span><span>JOIN payments p ON p.order_id = o.id</span></mark><mark class="line"><span class="number" aria-hidden="true">8</span><span>JOIN refunds r ON r.order_id = o.id</span></mark><span class="line"><span class="number" aria-hidden="true">9</span><span>GROUP BY o.id;</span></span></pre></div><div class="panel"><h3>Terminal output excerpt</h3><pre class="output"><span class="prompt">$ sqlassert suggest fan-trap.sql</span>
36
38
 
@@ -50,8 +50,9 @@ Compare contracts before answers:
50
50
  itself, with all of p's facts. Like
51
51
  Calcite, we also reject a whole padded side at once (per padding, item 9).
52
52
  - **Comparison types.** Calcite's `EquivalenceFinder` and FD projection
53
- ignore types and collations. Ours require identity comparison
54
- (`value_typing._identity_comparison`, `uniqueness._identity_inputs`).
53
+ ignore types and collations. Ours require identity comparison, or a
54
+ function that respects its inputs' equality
55
+ (`value_typing._identity_comparison`, `value_typing.respects_equality`).
55
56
  - **Dialects.** Calcite types MOD/DIVIDE as non-null and GREATEST as strict;
56
57
  DuckDB's `1 % 0` is NULL and its `greatest` skips NULLs. We model these per
57
58
  dialect (`convert._CHECKED_DIVISION_DIALECTS`, Builtins).
@@ -102,7 +103,7 @@ below), **different** (on purpose), **missing** (issue 45 item, the open ones no
102
103
 
103
104
  | Calcite | Behavior | Ours | Cases (nulls unless noted) | Verdict |
104
105
  |---|---|---|---|---|
105
- | Strong#createPolicyMap, #isNull | ANY policy: comparisons, LIKE, NOT, arithmetic, CAST, TRIM, FLOOR, ITEM, GREATEST | `ir/model.strict_inputs`, `ir/convert/builtins.dialect_builtins` | strong_right_join_through_arithmetic, strong_nondeterministic_conjunct_still_rejects, strong_nullif_first_argument, strong_trim_and_floor, strong_item_of_a_list, strong_item_of_a_list_may_be_null, strong_item_of_a_list_not_modelled | agrees for modelled Builtins (13); ITEM only where certified (DuckDB, PostgreSQL) |
106
+ | Strong#createPolicyMap, #isNull | ANY policy: comparisons, LIKE, NOT, arithmetic, CAST, TRIM, FLOOR, ITEM, GREATEST | `ir/model.strict_inputs`, `functions/table.py` | strong_right_join_through_arithmetic, strong_nondeterministic_conjunct_still_rejects, strong_nullif_first_argument, strong_trim_and_floor, strong_item_of_a_list, strong_item_of_a_list_may_be_null, strong_item_of_a_list_not_modelled | agrees for modelled Builtins (13); ITEM only where certified (DuckDB, PostgreSQL) |
106
107
  | Strong#isNotTrue | AND: any part; OR: every part | `rules/nullability._null_rejected` | strong_and_rejects_padded_side_through_one_part, strong_or_with_a_preserved_part, strong_not_is_not_null_keeps_padding | agrees per column |
107
108
  | RelOptUtil#simplifyJoin | Whole padded side NULL at once | per padding: `nullability._rejected_paddings` | strong_or_of_two_padded_columns, strong_or_of_is_not_null_on_padded_columns, strong_coalesce_of_padded_columns, strong_or_of_columns_two_joins_pad, strong_coalesce_of_columns_two_joins_pad, strong_or_with_a_nullable_preserved_part | agrees (9) |
108
109
  | RelOptUtil#simplifyJoin | FULL becomes LEFT/RIGHT one side at a time | `nullability.Padding` keyed by join and side | strong_full_join_where_rejects_its_own_side; `calcite_audit` full_join_* | fixed (bug 3) |