fix(iolib): JSON1SQLiteStore generierte Spalten konsistent (Single Source of Truth)#12
Merged
Merged
Conversation
…urce of Truth)
JSON1SQLiteStore war nicht instanziierbar (OperationalError: no such column).
Ursachen: (1) Heuristik key.startswith('_sdata_') nahm an, jeder _sdata_*-Key sei
eine generierte Spalte; (2) Spaltennamen _sdata_parent/_sdata_project vs. Keys
_sdata_parent_sname/_sdata_project_sname; (3) fehlende Spalte _sdata_suuid.
- GENERATED_COLUMNS als Single Source of Truth (Spaltenname == JSON-Key)
- _ensure_table erzeugt das Schema daraus; _sdata_suuid ergaenzt (+ unique Index)
- startswith-Heuristik -> Mengen-Mitgliedschaft (8 Stellen)
- Design-Begruendung: docs/rfc/0001-json1sqlitestore-index-naming.md
tests/iolib/test_json1sqlitestore.py: 32/32 gruen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
JSON1SQLiteStorewar nicht instanziierbar — bereits der Konstruktor warfsqlite3.OperationalError: no such column: _sdata_project_sname. Die kompletteTestsuite
tests/iolib/test_json1sqlitestore.py(32 Tests) scheiterte.Ursache (drei verschränkte Defekte)
key.startswith('_sdata_')nahm an, jeder_sdata_*-Key sei eine generierte Spalte — das Schema materialisiert aber nureine Teilmenge.
_sdata_parent/_sdata_projectvs.Keys
_sdata_parent_sname/_sdata_project_sname._sdata_suuid(vontest_initundget_id_by_key/update_by_suuidbenötigt).Lösung
GENERATED_COLUMNSals Single Source of Truth (Konvention: Spaltenname ==JSON-Key == Index-Key).
_ensure_tableerzeugt das Schema daraus;_sdata_suuidergänzt (+ unique Index).startswith-Heuristik → Mengen-Mitgliedschaft (key in GENERATED_COLUMNS);unbekannte
_sdata_*-Keys fallen sauber aufjson_extractzurück statt zu crashen.docs/rfc/0001-json1sqlitestore-index-naming.md.Tests
tests/iolib/test_json1sqlitestore.py: 32/32 grün (lokal via./ci/local-ci.sh tests/iolib/test_json1sqlitestore.py).