openstatspec 0.8.0__tar.gz → 0.8.1__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 (209) hide show
  1. {openstatspec-0.8.0 → openstatspec-0.8.1}/CHANGELOG.md +32 -2
  2. {openstatspec-0.8.0 → openstatspec-0.8.1}/PKG-INFO +2 -2
  3. {openstatspec-0.8.0 → openstatspec-0.8.1}/README.md +1 -1
  4. {openstatspec-0.8.0 → openstatspec-0.8.1}/docs/release-readiness.md +43 -5
  5. {openstatspec-0.8.0 → openstatspec-0.8.1}/docs/transformations.md +135 -0
  6. {openstatspec-0.8.0 → openstatspec-0.8.1}/pyproject.toml +1 -1
  7. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/spss/sav.py +12 -10
  8. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/sql/inplace_transform.py +65 -13
  9. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/sql/wide.py +181 -151
  10. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/sql/workflow.py +79 -79
  11. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/transform/validation.py +32 -41
  12. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_atomic_import.py +117 -0
  13. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_cli.py +1 -1
  14. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_dolt_conformance.py +9 -14
  15. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_inplace_transform.py +484 -11
  16. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_read_only_export.py +211 -7
  17. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_sql_services.py +159 -1
  18. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_sql_workflow.py +50 -0
  19. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_transform_frontend.py +109 -0
  20. {openstatspec-0.8.0 → openstatspec-0.8.1}/.github/verify_release_ref.py +0 -0
  21. {openstatspec-0.8.0 → openstatspec-0.8.1}/.github/workflows/ci.yml +0 -0
  22. {openstatspec-0.8.0 → openstatspec-0.8.1}/.github/workflows/release.yml +0 -0
  23. {openstatspec-0.8.0 → openstatspec-0.8.1}/.gitignore +0 -0
  24. {openstatspec-0.8.0 → openstatspec-0.8.1}/THIRD_PARTY_NOTICES.md +0 -0
  25. {openstatspec-0.8.0 → openstatspec-0.8.1}/docs/architecture.md +0 -0
  26. {openstatspec-0.8.0 → openstatspec-0.8.1}/docs/in-place-transformation.md +0 -0
  27. {openstatspec-0.8.0 → openstatspec-0.8.1}/docs/pyspssio-spike.md +0 -0
  28. {openstatspec-0.8.0 → openstatspec-0.8.1}/docs/sav-profile.md +0 -0
  29. {openstatspec-0.8.0 → openstatspec-0.8.1}/docs/sql-transformation-workflow.md +0 -0
  30. {openstatspec-0.8.0 → openstatspec-0.8.1}/docs/superpowers/plans/2026-08-12-python-v071-stable-pin.md +0 -0
  31. {openstatspec-0.8.0 → openstatspec-0.8.1}/docs/superpowers/specs/2026-08-12-python-stable-specification-pin-design.md +0 -0
  32. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/.github/workflows/ci.yml +0 -0
  33. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/.github/workflows/release.yml +0 -0
  34. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/.gitignore +0 -0
  35. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/CHANGELOG.md +0 -0
  36. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/CONTRIBUTING.md +0 -0
  37. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/README.md +0 -0
  38. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/RELEASING.md +0 -0
  39. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/ROADMAP.md +0 -0
  40. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/VERSIONING.md +0 -0
  41. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/fixtures/LICENSE.md +0 -0
  42. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/fixtures/README.md +0 -0
  43. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/fixtures/core-numeric-string.sav +0 -0
  44. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/fixtures/dictionary-and-display.sav +0 -0
  45. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/fixtures/generate-fixtures.sps +0 -0
  46. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/fixtures/long-utf8-and-attributes.sav +0 -0
  47. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/fixtures/missing-rules.sav +0 -0
  48. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/fixtures/sets.sav +0 -0
  49. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/fixtures/weight-and-string-mr.sav +0 -0
  50. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/fixtures/zsav-compressed.zsav +0 -0
  51. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/in-place-transformation-0.1.json +0 -0
  52. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/in-place-transformation-0.2.json +0 -0
  53. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/spss-sav-zsav-1.0.json +0 -0
  54. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/spss-syntax-frontend-0.1.json +0 -0
  55. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/spss-syntax-frontend-0.2.json +0 -0
  56. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/spss-syntax-frontend-0.3.json +0 -0
  57. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/sql-transformation-workflow-0.1.json +0 -0
  58. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/transformation-plan-0.1.json +0 -0
  59. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/conformance/transformation-plan-0.2.json +0 -0
  60. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/architecture.md +0 -0
  61. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/database-io-policy-v1.md +0 -0
  62. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/implementation-profiles/python-pyspssio-0.5.1.md +0 -0
  63. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/mssql-dialect-roadmap.md +0 -0
  64. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/spss-frontend-roadmap.md +0 -0
  65. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/spss-profile.md +0 -0
  66. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/spss-sav-zsav-profile-1.0.md +0 -0
  67. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/spss-syntax-frontend-profile-0.1.md +0 -0
  68. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/spss-syntax-frontend-profile-0.2.md +0 -0
  69. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/spss-syntax-frontend-profile-0.3.md +0 -0
  70. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/sql-transformation-workflow-profile-0.1.md +0 -0
  71. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/superpowers/plans/2026-08-12-roadmap-v030-bookkeeping.md +0 -0
  72. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/superpowers/plans/2026-08-21-spss-frontend-03.md +0 -0
  73. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/superpowers/specs/2026-08-21-spss-frontend-expansion-design.md +0 -0
  74. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/transformation-plan-profile-0.1.md +0 -0
  75. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/transformation-plan-profile-0.2.md +0 -0
  76. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/transformation-plan-sql-binding-0.1.md +0 -0
  77. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/docs/transformation-plan-sql-binding-0.2.md +0 -0
  78. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/examples/basic-spss-mapping.md +0 -0
  79. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/examples/spss-syntax-transformation-0.2.md +0 -0
  80. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/examples/spss-syntax-transformation-0.3.md +0 -0
  81. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/examples/spss-syntax-transformation.md +0 -0
  82. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/examples/sql-transformation-workflow.md +0 -0
  83. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/pyproject.toml +0 -0
  84. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/sql/dialect-profile-baseline.json +0 -0
  85. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/sql/dialect-profiles.md +0 -0
  86. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/sql/dolt-adapter-declaration-schema.json +0 -0
  87. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/sql/dolt-adapter-declarations/README.md +0 -0
  88. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/sql/profile-capabilities.md +0 -0
  89. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/sql/schema-outline.sql +0 -0
  90. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/sql/server-version-policy.md +0 -0
  91. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/sql/transformation-plan-profile-schema.sql +0 -0
  92. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/sql/transformation-workflow-profile-schema.sql +0 -0
  93. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/src/openstatspec_specification/__init__.py +0 -0
  94. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/src/openstatspec_specification/artifacts.py +0 -0
  95. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/src/openstatspec_specification/dolt.py +0 -0
  96. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/tests/test_contract_artifacts.py +0 -0
  97. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/tests/test_dolt_declarations.py +0 -0
  98. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/tools/validate_repository.py +0 -0
  99. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/transformation/plan-0.1.schema.json +0 -0
  100. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/transformation/plan-0.2.schema.json +0 -0
  101. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/transformation/spss-syntax-frontend-0.1.schema.json +0 -0
  102. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/transformation/spss-syntax-frontend-0.2.schema.json +0 -0
  103. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification/transformation/spss-syntax-frontend-0.3.schema.json +0 -0
  104. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/.github/workflows/ci.yml +0 -0
  105. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/.github/workflows/publish.yml +0 -0
  106. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/.gitignore +0 -0
  107. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/CHANGELOG.md +0 -0
  108. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/CONTRIBUTING.md +0 -0
  109. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/README.md +0 -0
  110. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/RELEASING.md +0 -0
  111. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/ROADMAP.md +0 -0
  112. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/VERSIONING.md +0 -0
  113. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/fixtures/LICENSE.md +0 -0
  114. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/fixtures/README.md +0 -0
  115. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/fixtures/core-numeric-string.sav +0 -0
  116. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/fixtures/dictionary-and-display.sav +0 -0
  117. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/fixtures/generate-fixtures.sps +0 -0
  118. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/fixtures/long-utf8-and-attributes.sav +0 -0
  119. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/fixtures/missing-rules.sav +0 -0
  120. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/fixtures/sets.sav +0 -0
  121. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/fixtures/weight-and-string-mr.sav +0 -0
  122. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/fixtures/zsav-compressed.zsav +0 -0
  123. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/in-place-transformation-0.1.json +0 -0
  124. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/in-place-transformation-0.2.json +0 -0
  125. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/spss-sav-zsav-1.0.json +0 -0
  126. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/spss-syntax-frontend-0.1.json +0 -0
  127. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/spss-syntax-frontend-0.2.json +0 -0
  128. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/sql-transformation-workflow-0.1.json +0 -0
  129. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/transformation-plan-0.1.json +0 -0
  130. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/conformance/transformation-plan-0.2.json +0 -0
  131. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/docs/architecture.md +0 -0
  132. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/docs/implementation-profiles/python-pyspssio-0.5.1.md +0 -0
  133. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/docs/mssql-dialect-roadmap.md +0 -0
  134. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/docs/spss-profile.md +0 -0
  135. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/docs/spss-sav-zsav-profile-1.0.md +0 -0
  136. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/docs/spss-syntax-frontend-profile-0.1.md +0 -0
  137. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/docs/spss-syntax-frontend-profile-0.2.md +0 -0
  138. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/docs/sql-transformation-workflow-profile-0.1.md +0 -0
  139. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/docs/transformation-plan-profile-0.1.md +0 -0
  140. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/docs/transformation-plan-profile-0.2.md +0 -0
  141. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/docs/transformation-plan-sql-binding-0.1.md +0 -0
  142. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/docs/transformation-plan-sql-binding-0.2.md +0 -0
  143. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/examples/basic-spss-mapping.md +0 -0
  144. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/examples/spss-syntax-transformation-0.2.md +0 -0
  145. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/examples/spss-syntax-transformation.md +0 -0
  146. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/examples/sql-transformation-workflow.md +0 -0
  147. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/pyproject.toml +0 -0
  148. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/sql/dialect-profile-baseline.json +0 -0
  149. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/sql/dialect-profiles.md +0 -0
  150. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/sql/dolt-adapter-declaration-schema.json +0 -0
  151. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/sql/dolt-adapter-declarations/README.md +0 -0
  152. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/sql/profile-capabilities.md +0 -0
  153. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/sql/schema-outline.sql +0 -0
  154. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/sql/server-version-policy.md +0 -0
  155. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/sql/transformation-plan-profile-schema.sql +0 -0
  156. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/sql/transformation-workflow-profile-schema.sql +0 -0
  157. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/src/openstatspec_specification/__init__.py +0 -0
  158. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/src/openstatspec_specification/dolt.py +0 -0
  159. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/tests/test_dolt_declarations.py +0 -0
  160. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/tools/validate_repository.py +0 -0
  161. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/transformation/plan-0.1.schema.json +0 -0
  162. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/transformation/plan-0.2.schema.json +0 -0
  163. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/transformation/spss-syntax-frontend-0.1.schema.json +0 -0
  164. {openstatspec-0.8.0 → openstatspec-0.8.1}/openstatspec-specification-package/transformation/spss-syntax-frontend-0.2.schema.json +0 -0
  165. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/__init__.py +0 -0
  166. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/api.py +0 -0
  167. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/cli.py +0 -0
  168. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/core/__init__.py +0 -0
  169. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/core/results.py +0 -0
  170. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/frontends/__init__.py +0 -0
  171. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/frontends/sas/.gitkeep +0 -0
  172. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/frontends/spss/__init__.py +0 -0
  173. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/frontends/spss/binding.py +0 -0
  174. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/frontends/spss/compiler.py +0 -0
  175. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/frontends/spss/execution.py +0 -0
  176. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/frontends/spss/syntax.py +0 -0
  177. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/frontends/stata/.gitkeep +0 -0
  178. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/spss/__init__.py +0 -0
  179. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/spss/dictionary.py +0 -0
  180. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/spss/raw_dictionary.py +0 -0
  181. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/sql/__init__.py +0 -0
  182. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/sql/capabilities.py +0 -0
  183. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/sql/catalog_api.py +0 -0
  184. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/sql/catalog_verification.py +0 -0
  185. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/sql/database_urls.py +0 -0
  186. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/sql/dolt_conformance.py +0 -0
  187. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/sql/normative.py +0 -0
  188. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/sql/profiles.py +0 -0
  189. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/transform/__init__.py +0 -0
  190. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/transform/errors.py +0 -0
  191. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/transform/plan.py +0 -0
  192. {openstatspec-0.8.0 → openstatspec-0.8.1}/src/openstatspec/transform/schema.py +0 -0
  193. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/conformance.py +0 -0
  194. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_attribute_catalog.py +0 -0
  195. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_catalog_lifecycle.py +0 -0
  196. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_catalog_persistence_review.py +0 -0
  197. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_conditional_inplace_transform.py +0 -0
  198. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_document_round_trip.py +0 -0
  199. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_loss_reports.py +0 -0
  200. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_normative_catalog.py +0 -0
  201. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_official_conformance.py +0 -0
  202. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_pyspssio_catalog_authority.py +0 -0
  203. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_release_ref.py +0 -0
  204. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_review_transaction_boundary.py +0 -0
  205. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_sav_sqlite.py +0 -0
  206. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_spss_catalog_preflight.py +0 -0
  207. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_sql_profiles.py +0 -0
  208. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_strict_catalog_review.py +0 -0
  209. {openstatspec-0.8.0 → openstatspec-0.8.1}/tests/test_vls_compatible_names.py +0 -0
@@ -2,9 +2,39 @@
2
2
 
3
3
  All notable changes to this reference implementation are documented here.
4
4
 
5
- ## Unreleased
5
+ ## 0.8.1 - 2026-09-10
6
6
 
7
- _No unreleased changes._
7
+ ### Fixed
8
+
9
+ - Preserve other variables' shared value labels when replacing one variable's
10
+ labels. Reject deletion of variables referenced by published derived lineage
11
+ before any plan mutation, with `variable_has_dependents`.
12
+ - Enable and verify SQLite foreign keys on in-place apply connections.
13
+ - Read export values, dictionary metadata, import fidelity events and validation
14
+ reflection from one native database snapshot; close it before writing SAV/ZSAV.
15
+ - Scope transformation label reads to the target variable's dataset. Unrelated
16
+ malformed labels no longer fail the operation; malformed target-linked labels
17
+ still fail, and shared/foreign-owned linked label sets remain supported.
18
+
19
+ ### Performance
20
+
21
+ - Remove quadratic suffix/name scans from canonical-plan binding and reuse one
22
+ canonical plan encoding/hash per public canonical or SPSS apply.
23
+ - Remove redundant full case-row dictionary collections from database reads and
24
+ imports. Results remain buffered; this is not a streaming API.
25
+ - Avoid the discarded core relation hash during SQLite workflow registration,
26
+ retaining physical projection validation and derived-parent integrity checks.
27
+ Execution-time hashes remain required; their loop avoids a redundant tuple copy.
28
+
29
+ ### Documentation and cleanup
30
+
31
+ - Document numeric create/replace, RECODE and separately provisioned target
32
+ recipes, with bounded local SQLite measurements in the transformations manual.
33
+ - Remove an unreachable view-creation branch; workflow output remains
34
+ materialized-only.
35
+
36
+ The specification pin, engine dependency, database/profile claims, catalog schema,
37
+ public call signatures and Dolt-owned versioning policy remain unchanged.
8
38
 
9
39
  ## 0.8.0 - 2026-09-07
10
40
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: openstatspec
3
- Version: 0.8.0
3
+ Version: 0.8.1
4
4
  Summary: Reference adapter for the OpenStatSpec relational contract
5
5
  Author: OpenStatSpec
6
6
  License: Apache-2.0
@@ -23,7 +23,7 @@ The reference Python implementation of the OpenStatSpec specification.
23
23
 
24
24
  This package implements the specification; it does not define or extend it.
25
25
  The normative model lives in the `OpenStatSpec/specification` repository.
26
- Python 0.8.0 pins released specification `v0.5.0` at
26
+ Python 0.8.1 pins released specification `v0.5.0` at
27
27
  `864e84479f554b8ee250ffed44c4dfb963750d4a` and selects SAV/ZSAV 1.0 with
28
28
  `database_io_policy=openstatspec-database-io-v1`. This does not claim
29
29
  implementation of the optional Transformation Workflow 0.3 profile.
@@ -4,7 +4,7 @@ The reference Python implementation of the OpenStatSpec specification.
4
4
 
5
5
  This package implements the specification; it does not define or extend it.
6
6
  The normative model lives in the `OpenStatSpec/specification` repository.
7
- Python 0.8.0 pins released specification `v0.5.0` at
7
+ Python 0.8.1 pins released specification `v0.5.0` at
8
8
  `864e84479f554b8ee250ffed44c4dfb963750d4a` and selects SAV/ZSAV 1.0 with
9
9
  `database_io_policy=openstatspec-database-io-v1`. This does not claim
10
10
  implementation of the optional Transformation Workflow 0.3 profile.
@@ -1,8 +1,17 @@
1
- # 0.8.0 release readiness
1
+ # 0.8.1 release readiness
2
2
 
3
3
  This page records the expected release contract, not a publication event.
4
4
  Creating a version tag remains a separate maintainer action.
5
5
 
6
+ ## Patch scope
7
+
8
+ Version 0.8.1 includes the merged metadata-integrity, consistent-read-snapshot,
9
+ row-copy, transformation-planning and SQLite workflow fixes described in the
10
+ [release notes](../CHANGELOG.md). It introduces no catalog
11
+ migration, dependency change, new database support or specification pin update.
12
+ The local 0.8.0 evidence below is historical, not verification of this patch.
13
+ Re-run the gates below on the exact selected 0.8.1 release commit.
14
+
6
15
  The release selects SAV/ZSAV 1.0 with the optional Database I/O Execution
7
16
  Policy `openstatspec-database-io-v1`. Reads and exports, including failures,
8
17
  write no database audit records; export results omit `operation_id` and return
@@ -104,7 +113,7 @@ The gate must prove that:
104
113
  neither HEAD nor branch and never commits or resets; state is rechecked after
105
114
  the dataset lock and success must leave an inspectable working-set diff;
106
115
  other supported SQL connections remain allowed; and
107
- - string comparisons and v0.2 string assignments fail closed until exact
116
+ - string comparisons and v0.2 string assignments remain fail-closed.
108
117
 
109
118
  The built wheel must contain the generic openstatspec.transform modules and the
110
119
  implemented openstatspec.frontends.spss package. Stata and SAS remain empty
@@ -156,7 +165,24 @@ of exact `864e84479f554b8ee250ffed44c4dfb963750d4a`):
156
165
  Other database services were not configured locally. This is local evidence,
157
166
  not a claim that the updated remote CI or release publication has completed.
158
167
 
159
- ## Maintainer checks before tagging
168
+ ## 0.8.1 local preparation verification
169
+
170
+ On Python 3.13.2 with SQLAlchemy 2.0.52 and the exact v0.5.0 specification
171
+ checkout, without configured database services:
172
+
173
+ - `python -m pytest -p no:cacheprovider -m 'not services'`: **414 passed,
174
+ 9 skipped, 53 deselected**. The release-ref guard tests also passed (**5**).
175
+ - `compileall`, `git diff --check`, wheel/sdist build and `twine check` passed.
176
+ - A clean wheel install outside the checkout resolved the required engine
177
+ `openstatspec-pyspssio==0.5.1.post2` from PyPI. Installed capabilities reported
178
+ 0.8.1, released specification v0.5.0 at the expected commit, and the selected
179
+ database I/O policy. Core, SPSS frontend and legacy compiler re-exports loaded
180
+ from `site-packages` without a source-path override.
181
+
182
+ This is local candidate evidence, not final release-commit service CI or
183
+ publication evidence. No v0.8.1 tag or registry upload was made by these checks.
184
+
185
+ ## Maintainer release checklist
160
186
 
161
187
  1. Publish the pinned `openstatspec-pyspssio==0.5.1.post2` engine distribution
162
188
  first and confirm that a clean environment can download it from PyPI. The
@@ -179,14 +205,26 @@ not a claim that the updated remote CI or release publication has completed.
179
205
  4. Build with `python -m build` and install the generated wheel in a clean
180
206
  environment, resolving `openstatspec-pyspssio==0.5.1.post2` from PyPI.
181
207
  Run the installed CLI outside the source checkout with `PYTHONPATH` unset;
182
- verify adapter version `0.8.0` and the selected database I/O policy.
208
+ verify adapter version `0.8.1` and the selected database I/O policy.
183
209
  5. Confirm `openstatspec capabilities` reflects the intended support boundary.
184
210
  6. Confirm CI, release fixtures, and capabilities use the published OpenStatSpec
185
211
  specification `v0.5.0` at exact commit
186
212
  `864e84479f554b8ee250ffed44c4dfb963750d4a`, publish
187
213
  `specification_status=released`, and set `specification_release` to `v0.5.0`.
188
214
  Use an exact checkout via `OPENSTATSPEC_SPECIFICATION_DIR` for local tests.
189
- 7. Review this document, the README, and CHANGELOG for accurate scope.
215
+ 7. Review this document, the README, and CHANGELOG for accurate scope. Finalize
216
+ the 0.8.1 changelog date before selecting the final release commit.
217
+ 8. Confirm the exact release commit's CI matrix and package smoke passed, and
218
+ verify the protected `pypi` environment and Trusted Publishing setup before
219
+ pushing a new annotated/protected `v0.8.1` tag. A `v*` tag push starts the
220
+ publishing workflow; it is not a preparation-only check. Do not move an
221
+ existing tag. The workflow also rebuilds the unchanged specification companion
222
+ package 0.1.0 at its existing pin and uses `skip-existing`; it does not release
223
+ the newer specification validator changes.
224
+ 9. After publication, verify the tag resolves to the intended commit, the
225
+ tag-triggered workflow succeeded, and PyPI installs `openstatspec==0.8.1` in a
226
+ clean environment. Record the tag, CI and registry evidence before claiming
227
+ the release is published.
190
228
 
191
229
  The tag-triggered release workflow repeats the non-service test suite, builds
192
230
  the distributions, and installs the wheel with the exact required SPSS engine
@@ -135,6 +135,141 @@ openstatspec apply-spss --database-url sqlite:///survey.sqlite \
135
135
 
136
136
  On Dolt, also pass `--expected-branch` and `--expected-head`.
137
137
 
138
+ ## Numeric targets: create versus replace
139
+
140
+ `COMPUTE` chooses its canonical target mode from the live schema. An absent
141
+ numeric target lowers to `assign` with `target_mode=create`; it appends one
142
+ nullable numeric column and one catalog variable. An existing numeric target
143
+ lowers to `target_mode=replace`. Replace keeps the variable ID, ordinal, and
144
+ metadata that no later operation explicitly changes. `IF` requires an existing
145
+ target, so a new target must be initialized first. Variable-source `NULL`
146
+ propagates through assignment; a predicate changes a row only when its SQL
147
+ truth value is `TRUE`.
148
+
149
+ For example, this is a create-or-replace program for a numeric target. On
150
+ SQLite/PostgreSQL it creates `target` when absent; with a pre-existing numeric
151
+ `target` it updates the same target instead:
152
+
153
+ ```text
154
+ COMPUTE target = source_a.
155
+ IF (source_a = 1 AND source_b = 1) target = 1.
156
+ IF (target = 1 AND source_b = 1) target = 2.
157
+ VARIABLE LABELS target 'Numeric target'.
158
+ VALUE LABELS target 0 'No' 1 'Yes'.
159
+ FORMATS target (F8.1).
160
+ VARIABLE LEVEL target (NOMINAL).
161
+ EXECUTE.
162
+ ```
163
+
164
+ `RECODE ... INTO` always requests a new target and rejects an existing target
165
+ name. A canonical replace recode must use the same source and target name.
166
+ Without `ELSE`, create recodes use `system_missing` for unmatched rows, while
167
+ replace recodes use `copy`. To pre-provision `band` and preserve the create
168
+ semantics, initialize and recode it explicitly. The absent-target form is:
169
+
170
+ ```text
171
+ RECODE source_a (1 = 0.1) (2 = 1) INTO band.
172
+ ```
173
+
174
+ The pre-existing-target form is:
175
+
176
+ ```text
177
+ COMPUTE band = source_a.
178
+ RECODE band (1 = 0.1) (2 = 1) (ELSE = SYSMIS).
179
+ ```
180
+
181
+ The second form has an extra ordered assignment and is not a pure DDL-overhead
182
+ comparison. Omitting its `ELSE` would copy unmatched source values instead of
183
+ matching the create form. For canonical plans, create recodes use
184
+ `target_mode=create` and replace recodes use `source=target`,
185
+ `target_mode=replace`.
186
+
187
+ On SQLite and PostgreSQL, numeric create is supported only where the adapter
188
+ has the atomic native transaction boundary. MySQL, MariaDB, and Dolt reject a
189
+ create target with `schema_change_not_atomic`. A caller must use a separate,
190
+ explicit, versioned provisioning action that creates both the nullable physical
191
+ column and its matching normative variable, including a unique variable ID,
192
+ the same physical binding, and the next ordinal. Provisioning is not an apply
193
+ step, and this package does not hide it behind a new helper or API. See the
194
+ specification's [In-Place Transformation Binding 0.2 target-creation
195
+ rules](https://github.com/OpenStatSpec/specification/blob/main/docs/transformation-plan-sql-binding-0.2.md#target-creation-by-sql-profile).
196
+ For Dolt, commit provisioning separately; the later apply starts from that
197
+ clean committed `HEAD` and supplies it as `expected_head`. The SQLite matrix
198
+ below is local evidence only and is not service or cross-engine evidence.
199
+
200
+ ## Local numeric-target measurement
201
+
202
+ The following is a bounded observation of the existing workflow, not a
203
+ release-to-release benchmark. A disposable standard-library harness created a
204
+ fresh file-backed SQLite database for every variant and repetition, kept
205
+ fixture setup separate from the timed public call, and removed all temporary
206
+ files afterward. It covered two workloads (A: the `COMPUTE`/`IF` program above;
207
+ B: `RECODE`), create versus pre-provisioned replace, 100 versus 100,000 cases,
208
+ and both `apply_transformation_plan_in_place` and `apply_spss_in_place`. Each
209
+ cell had one counted fresh apply, one fresh warm-up, and five fresh timed
210
+ applies; create/replace order alternated by repetition. Each counted,
211
+ warm-up, and timed apply started from a newly created fixture database; no
212
+ apply reused a database from another trial. Rows were generated by cycling
213
+ this input sequence in order: `(1,1)`, `(1,NULL)`, `(NULL,1)`, `(0,1)`,
214
+ `(2,2)`, `(0.1,0)`, `(-9,1)`, `(NULL,0)`. Thus the 100-row runs used 12 full
215
+ cycles plus the first four rows of a cycle, while the 100,000-row runs used
216
+ 12,500 full cycles. Each fixture had numeric `source_a` and `source_b`; `source_a` carried
217
+ label `Source A` and missing rule `99`, while `source_b` carried label
218
+ `Source B` and no missing rule. Replace fixtures added one nullable numeric
219
+ ordinal-3 target (`target` for A, `band` for B) with label `Old target`, `F4.0`
220
+ formats, ordinal measurement level, and missing rule `99`; create fixtures had
221
+ no target column.
222
+
223
+ The counted value is an outermost SQLAlchemy `Connection.execute` or
224
+ `Connection.exec_driver_sql` invocation scoped to the owned database. It
225
+ includes profile probes, catalog checks, reflection, explicit `BEGIN`, DDL,
226
+ DML, and audit work; one executemany call counts once. It is not a driver wire
227
+ round-trip count. Timed values are the public apply call only: setup,
228
+ validation, and cleanup are excluded. Every counted and timed result checked
229
+ ordered rows, explicit `NULL`s, binary64 bits (including `0.1`), source and
230
+ target identity, catalog/audit provenance, and absence of forbidden copy or
231
+ snapshot artifacts before being retained.
232
+
233
+ Environment and revisions: Python 3.13.2, SQLite 3.47.1, SQLAlchemy 2.0.52,
234
+ Linux 6.6.87.2-microsoft-standard-WSL2 on x86_64 with 12 logical CPUs and
235
+ local temporary-file storage; observed file settings were
236
+ `journal_mode=delete` and `synchronous=2` (`FULL`). The Python source was
237
+ `63a66d6589aeb8fdc4820d5e7217fc13c61ef3b9`; the reviewed specification
238
+ reference was `930345b922af4f43b0e622be02d4b12ebfeb08eb`. Fixture setup was
239
+ recorded separately and excluded from the table.
240
+
241
+ | Workload | Cases | API | Mode | SQLAlchemy executes | Median ms | Min ms | Max ms |
242
+ | --- | ---: | --- | --- | ---: | ---: | ---: | ---: |
243
+ | A | 100 | canonical plan | create | 234 | 76.5 | 65.8 | 78.4 |
244
+ | A | 100 | SPSS | create | 237 | 69.3 | 66.8 | 78.2 |
245
+ | A | 100 | canonical plan | replace | 222 | 67.6 | 56.6 | 88.3 |
246
+ | A | 100 | SPSS | replace | 225 | 71.3 | 69.3 | 88.5 |
247
+ | A | 100,000 | canonical plan | create | 234 | 168.8 | 134.1 | 172.3 |
248
+ | A | 100,000 | SPSS | create | 237 | 160.2 | 149.4 | 170.3 |
249
+ | A | 100,000 | canonical plan | replace | 222 | 162.7 | 146.0 | 173.6 |
250
+ | A | 100,000 | SPSS | replace | 225 | 155.4 | 144.8 | 177.6 |
251
+ | B | 100 | canonical plan | create | 224 | 61.6 | 55.6 | 76.6 |
252
+ | B | 100 | SPSS | create | 227 | 77.1 | 65.5 | 312.8 |
253
+ | B | 100 | canonical plan | replace | 213 | 64.2 | 60.2 | 223.1 |
254
+ | B | 100 | SPSS | replace | 216 | 80.9 | 62.2 | 237.5 |
255
+ | B | 100,000 | canonical plan | create | 224 | 149.4 | 131.7 | 193.4 |
256
+ | B | 100,000 | SPSS | create | 227 | 144.1 | 128.3 | 158.4 |
257
+ | B | 100,000 | canonical plan | replace | 213 | 169.8 | 163.6 | 186.6 |
258
+ | B | 100,000 | SPSS | replace | 216 | 192.8 | 171.4 | 202.8 |
259
+
260
+ The canonical plan operation/hash identities for the same runs were:
261
+
262
+ | Workload | Mode | Operations | Contract | Canonical plan SHA-256 |
263
+ | --- | --- | ---: | --- | --- |
264
+ | A | create | 8 | v0.2 | `6b17a220f9be9d2d29b671dd5eb4598ea34ae459e4d3b8e84a7daafbe3ec11ef` |
265
+ | A | replace | 8 | v0.2 | `a239cac39d3fade1207228bee4296a444669eb31e154e6cea09f378ea75b12eb` |
266
+ | B | create | 1 | v0.1 | `2057e57117100ba3efd5becf5254f47a5696bc8631c35480a5a6d2f5b1327f83` |
267
+ | B | replace | 2 | v0.2 | `23b4bbf06383c5e73e04356af079db1e6fe0827f8afdb406f849169306fa2214` |
268
+
269
+ These observations do not establish service latency, wire round trips,
270
+ row-independent cost, or a before/after speedup for any release. They are
271
+ owned SQLite evidence for the documented behavior at the revisions above.
272
+
138
273
  ## Database and Dolt invariants
139
274
 
140
275
  Every successful apply preserves the logical `dataset_id` and physical
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "openstatspec"
7
- version = "0.8.0"
7
+ version = "0.8.1"
8
8
  description = "Reference adapter for the OpenStatSpec relational contract"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -54,8 +54,9 @@ from ..sql.dolt_conformance import DoltConformanceSource
54
54
  from ..sql.wide import (
55
55
  create_wide_dataset,
56
56
  physical_name,
57
- read_fidelity_events,
58
- read_wide_dataset,
57
+ _read_fidelity_events,
58
+ _read_snapshot,
59
+ _read_wide_dataset,
59
60
  validate_spss_catalog,
60
61
  )
61
62
 
@@ -556,20 +557,21 @@ def export_sav_dataset(
556
557
  destination_path = Path(destination)
557
558
  if destination_path.suffix.lower() not in {".sav", ".zsav"}:
558
559
  raise UnsupportedOperationError("Export destinations must use the .sav or .zsav extension.")
559
- dataset, variables, rows = read_wide_dataset(
560
- database_url=database_url, dataset_id=dataset_id,
560
+ with _read_snapshot(
561
+ database_url=database_url,
561
562
  dolt_conformance_source=dolt_conformance_source,
562
- )
563
+ ) as (connection, profile):
564
+ dataset, variables, rows = _read_wide_dataset(
565
+ connection, dataset_id=dataset_id, profile=profile,
566
+ )
567
+ persisted_events = _read_fidelity_events(
568
+ connection, dataset_id=dataset["dataset_id"], direction="import",
569
+ )
563
570
  validate_spss_catalog(
564
571
  variables,
565
572
  case_weight_variable=dataset.get("case_weight_variable"),
566
573
  multiple_response_sets=dataset.get("multiple_response_sets"),
567
574
  )
568
- persisted_events = read_fidelity_events(
569
- database_url=database_url, dataset_id=dataset_id,
570
- direction="import",
571
- dolt_conformance_source=dolt_conformance_source,
572
- )
573
575
  if legacy_locale is not None:
574
576
  persisted_events = tuple(
575
577
  event for event in persisted_events
@@ -2,6 +2,8 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import hashlib
6
+
5
7
  from collections.abc import Callable, Mapping
6
8
  from dataclasses import dataclass
7
9
  from datetime import UTC, datetime
@@ -11,7 +13,7 @@ from uuid import uuid4
11
13
  from sqlalchemy import (
12
14
  Column, DateTime, Float, Integer, MetaData, String, Table, Text, and_, case,
13
15
  create_engine, delete, inspect, insert, literal, null, select, text, update,
14
- or_,
16
+ or_, event as sqlalchemy_event,
15
17
  )
16
18
 
17
19
  from ..transform import (
@@ -29,7 +31,7 @@ from .dolt_conformance import DoltConformanceSource
29
31
  from .normative import catalog as core_catalog
30
32
  from .profiles import SqlProfile, preflight
31
33
  from .wide import physical_name, require_verified_catalog
32
- from .workflow import TransformationError
34
+ from .workflow import TransformationError, workflow_catalog
33
35
 
34
36
 
35
37
  APPLY_CONTRACT = "openstatspec-in-place-transformation-v0.2"
@@ -177,8 +179,12 @@ def _input_schema(
177
179
  core.value_label,
178
180
  core.variable_value_label_set.c.value_label_set_id
179
181
  == core.value_label.c.value_label_set_id,
182
+ ).join(
183
+ core.variable,
184
+ core.variable_value_label_set.c.variable_id
185
+ == core.variable.c.variable_id,
180
186
  )
181
- ).order_by(
187
+ ).where(core.variable.c.dataset_id == dataset_id).order_by(
182
188
  core.variable_value_label_set.c.variable_id,
183
189
  core.value_label.c.ordinal,
184
190
  )
@@ -278,15 +284,21 @@ def _replace_value_labels(
278
284
  )
279
285
  ).scalar_one_or_none()
280
286
  if old_set is not None:
281
- connection.execute(delete(core.value_label).where(
282
- core.value_label.c.value_label_set_id == old_set
283
- ))
284
287
  connection.execute(delete(core.variable_value_label_set).where(
285
288
  core.variable_value_label_set.c.variable_id == variable_id
286
289
  ))
287
- connection.execute(delete(core.value_label_set).where(
288
- core.value_label_set.c.value_label_set_id == old_set
289
- ))
290
+ still_used = connection.execute(
291
+ select(core.variable_value_label_set.c.variable_id).where(
292
+ core.variable_value_label_set.c.value_label_set_id == old_set
293
+ )
294
+ ).first()
295
+ if still_used is None:
296
+ connection.execute(delete(core.value_label).where(
297
+ core.value_label.c.value_label_set_id == old_set
298
+ ))
299
+ connection.execute(delete(core.value_label_set).where(
300
+ core.value_label_set.c.value_label_set_id == old_set
301
+ ))
290
302
  label_set_id = str(uuid4())
291
303
  connection.execute(insert(core.value_label_set).values(
292
304
  value_label_set_id=label_set_id,
@@ -465,6 +477,7 @@ def _apply_plan_on_connection(
465
477
  dolt_branch: str | None,
466
478
  dolt_head: str | None,
467
479
  mutation_journal: dict[str, Any] | None = None,
480
+ encoded_plan: tuple[bytes, str] | None = None,
468
481
  ) -> dict[str, Any]:
469
482
  before_identity = _target_identity_state(connection, dataset_id, lock_dataset=True)
470
483
  if before_identity[3] != 1:
@@ -476,6 +489,26 @@ def _apply_plan_on_connection(
476
489
  table_name = _physical_table_name(dataset)
477
490
  plan = submission.plan
478
491
  bound = bind_transformation_plan(plan, schema)
492
+ deleted_names = {
493
+ operation.variable.casefold() for operation in plan.operations
494
+ if isinstance(operation, DeleteVariableOperation)
495
+ }
496
+ original_deletions = {
497
+ str(row["variable_id"]): str(row["source_name"]) for row in variables
498
+ if str(row["source_name"]).casefold() in deleted_names
499
+ }
500
+ if original_deletions and inspect(connection).has_table("derived_variable_lineage"):
501
+ lineage = workflow_catalog(MetaData()).derived_variable_lineage
502
+ blocked_id = connection.execute(
503
+ select(lineage.c.core_variable_id).where(
504
+ lineage.c.core_variable_id.in_(original_deletions)
505
+ ).limit(1)
506
+ ).scalar_one_or_none()
507
+ if blocked_id is not None:
508
+ raise TransformationError(
509
+ "variable_has_dependents",
510
+ f"Variable {original_deletions[blocked_id]!r} is referenced by published lineage.",
511
+ )
479
512
  output_used_physical = {"__case_ordinal"}
480
513
  output_variables = [
481
514
  {
@@ -766,6 +799,10 @@ def _apply_plan_on_connection(
766
799
  started = _now()
767
800
  if mutation_journal is not None:
768
801
  mutation_journal["apply_id"] = apply_id
802
+ if encoded_plan is None:
803
+ plan_bytes = plan.canonical_bytes()
804
+ encoded_plan = plan_bytes, hashlib.sha256(plan_bytes).hexdigest()
805
+ plan_bytes, plan_hash = encoded_plan
769
806
  connection.execute(insert(audit).values(
770
807
  apply_id=apply_id,
771
808
  contract_id=APPLY_CONTRACT,
@@ -776,8 +813,8 @@ def _apply_plan_on_connection(
776
813
  source_kind=submission.source_kind,
777
814
  source_hash=submission.source_hash,
778
815
  frontend_contract=submission.frontend_contract,
779
- plan_hash=plan.sha256(),
780
- canonical_plan_json=plan.canonical_json(),
816
+ plan_hash=plan_hash,
817
+ canonical_plan_json=plan_bytes.decode("utf-8"),
781
818
  actor=actor,
782
819
  status="succeeded",
783
820
  dolt_branch=dolt_branch,
@@ -811,7 +848,7 @@ def _apply_plan_on_connection(
811
848
  "source_kind": submission.source_kind,
812
849
  "source_hash": submission.source_hash,
813
850
  "frontend_contract": submission.frontend_contract,
814
- "plan_hash": plan.sha256(),
851
+ "plan_hash": plan_hash,
815
852
  "dolt_branch": dolt_branch,
816
853
  "dolt_head_before": dolt_head,
817
854
  "dolt_head_after": dolt_head,
@@ -952,6 +989,7 @@ def _run_in_place_submission(
952
989
  dataset_id: str,
953
990
  actor: str,
954
991
  prepare: Callable[[Any, str], InPlacePlanSubmission],
992
+ encoded_plan: tuple[bytes, str] | None = None,
955
993
  expected_branch: str | None = None,
956
994
  expected_head: str | None = None,
957
995
  dolt_conformance_source: DoltConformanceSource | None = None,
@@ -972,6 +1010,17 @@ def _run_in_place_submission(
972
1010
  sqlite_version = (*sqlite_version_parts, 0, 0)[:3]
973
1011
  allow_delete_variable = sqlite_version >= (3, 35, 0)
974
1012
  engine = create_engine(database_url)
1013
+ if profile.name == "sqlite":
1014
+ @sqlalchemy_event.listens_for(engine, "connect")
1015
+ def enable_sqlite_foreign_keys(dbapi_connection, _connection_record):
1016
+ cursor = dbapi_connection.cursor()
1017
+ try:
1018
+ cursor.execute("PRAGMA foreign_keys = ON")
1019
+ if cursor.execute("PRAGMA foreign_keys").fetchone() != (1,):
1020
+ raise RuntimeError("SQLite foreign-key enforcement could not be enabled.")
1021
+ finally:
1022
+ cursor.close()
1023
+
975
1024
  journal: dict[str, Any] = {}
976
1025
  branch: str | None = None
977
1026
  head: str | None = None
@@ -1025,6 +1074,7 @@ def _run_in_place_submission(
1025
1074
  dolt_branch=branch,
1026
1075
  dolt_head=head,
1027
1076
  mutation_journal=journal,
1077
+ encoded_plan=encoded_plan,
1028
1078
  )
1029
1079
  if profile.name == "dolt":
1030
1080
  after_branch, after_head, dirty_after = _dolt_state(connection)
@@ -1079,7 +1129,8 @@ def apply_transformation_plan_in_place(
1079
1129
  if isinstance(plan, TransformationPlan)
1080
1130
  else transformation_plan_from_dict(plan)
1081
1131
  )
1082
- plan_hash = normalized.sha256()
1132
+ plan_bytes = normalized.canonical_bytes()
1133
+ plan_hash = hashlib.sha256(plan_bytes).hexdigest()
1083
1134
  submission = InPlacePlanSubmission(
1084
1135
  plan=normalized,
1085
1136
  source_kind="canonical_plan",
@@ -1090,6 +1141,7 @@ def apply_transformation_plan_in_place(
1090
1141
  dataset_id=dataset_id,
1091
1142
  actor=actor,
1092
1143
  prepare=lambda _connection, _dataset_id: submission,
1144
+ encoded_plan=(plan_bytes, plan_hash),
1093
1145
  expected_branch=expected_branch,
1094
1146
  expected_head=expected_head,
1095
1147
  dolt_conformance_source=dolt_conformance_source,