-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support round-tripping between SQLite and CLDF #58
Comments
I guess that would be cool. Would require a lot of tests, though, I guess. |
@Anaphory I think round-trip-ability to SQLite would be a big win - in particular considering use cases like the one you outline. I guess the best way to do this would be via very close mirroring of the CLDF schema in the db, i.e.
|
Alternatively, all the metadata could be kept out of the database, and the original JSON description could be consulted only upon serialising the dataset as CLDF again. This could create a bit of ambiguity, though, because in CLDF we have this shortcut for many-to-many relations without additional properties on the association table: These can be specified by using a list-valued column as foreign key. But this could also be deduced from the DB schema - leaving just the ambiguity of where to put the foreign key. @Anaphory any ideas/preferences regarding this issue? |
Sorry, I'll keep my internal monologue going: The above isn't really true: If we consult the original JSON when writing the db to CLDF, we'll know what to do. |
I start leaning towards keeping the JSON metadata out of the DB. Basically, SQLite would become an alternative backend for the data, while the description will always reside in the JSON file. The alternative SQLite backend could even be used to speed up validating a dataset. |
@Anaphory @lmaurits I have a proto-type for round-tripping CSV / SQLite data storage for CSVW TableGroups ready. What remains to do is
|
@Anaphory so with what I implemented now, your workflow could look like:
|
@Anaphory note that the SQLite DB contains:
So this database should be fairly safe and complete for adding data (as long as you don't want to add tables or columns - this would heve to be done in the JSON before running |
Almost idempotency confirmed for somewhat complex examples (Grambank and the Tseltal dictionary). Not fully round-trippable:
|
I have just found that although I had no idea about
PyQt5
yesterday, I was easily able to write a sortable, filterable word list viewer in it today usingQSqlDatabase.addDatabase("QSQLITE")
. This gives me an editable interface to myFormTable
, which has me wondering how I can feed the changes I make back into CLDF.Does it make sense to have a
cldf fromdb DATABASEFILE DIRECTORY
subcommand? Can we have it so that ifDIRECTORY
already contains CLDF datasets of those types its table urls (and other data that might not be in the DB but in the JSON?) are used instead of defaults, so it will be round-trip safe?The text was updated successfully, but these errors were encountered: