Repository navigation
Preserve list-valued reference keys and contexts in SQLite - #87
Merged
Merged
Conversation
Contributor
|
For a bit of context: SQLite was always just meant as a format to allow performant analysis of CSVW data. So round-tripping data back from SQLite to CSVW was more of a proof-of-concept thing. And the "list-valued foreign keys" feature is something that isn't clearly spelt out in the CSVW spec. I implemented it because we explicitly allow this for CLDF datasets - where ID columns are typically very restricted, not allowing whitespace. Anyway, making this functionality more robust is ceertainly welcome! |
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.
Reading list-valued foreign keys from SQLite can change their values and drop references. For example:
Before:
['New', 'York']. After:['New York', 'San Francisco'].The stored association rows are correct, but
group_concatfollowed by whitespace splitting loses the key boundaries. The same aggregation can split a custom context containing||. Read the individual rows and group them in Python, preserving each key/context value and repeated association. Add regressions for spaces, tabs, newlines, repeated keys, two foreign-key columns and opaque custom contexts.Validation: the full suite passes on Python 3.12 (835 passed, 16 expected failures) and 3.9 (838 passed, 13 expected failures), with 100% configured coverage; changed-file Flake8 passes. A separate relational workflow uses published Concepticon labels in 128 multiword configurations across memory/file SQLite, CSV serialization and table/scalar-column translation. All fail before and pass after; all 128 complete single-word controls are unchanged. Raw SQLite association rows and foreign-key checks provide independent references. Source and an installed wheel reproduce the same results.