4 ms·
SQLite has an session extension, which will track changes to a set of tables and produce a changeset/patchset which can patch previous version of an SQLite data
by RenThraysk 1y ago
SQLite has an session extension, which will track changes to a set of tables and produce a changeset/patchset which can patch previous version of an SQLite database.
https://www.sqlite.org/sessionintro.html https://www.sqlite.org/sessionintro.html
- simonw 1y agoHave you used that? I've read the documentation but I don't think I've ever heard from anyone who uses the extension.
- RenThraysk 1y agoI have, atleast to confirm it does what it says on the tin. Idea for an offline first app, where each app install call pull a changeset and apply it to their local db.
- oefrha 1y agoI have yet to see a single SQLite binding supporting this, so it’s quite useless unless you’re writing your application in C, or are open to patching the language binding. In one of my projects I have implemented my own poor man’s session by writing all the statements and parameters into a separate database, then sync that and replay. Works well enough for a ~30GB database that changes by ~0.1% every day.
- RenThraysk 1y agoThere are atleast two SQLite bindings for Go. https://github.com/crawshaw/sqlite https://github.com/crawshaw/sqlite https://github.com/eatonphil/gosqlite/ https://github.com/eatonphil/gosqlite/ Ended up with the latter, but did have to add one function binding in C, to inspect changesets.
- ncruces 1y agoI'm open to adding it to my driver, if people consider it essential. Every extra bit makes AOT compiling the Wasm slower (impacting startup time). I also wanna keep the number of variants reasonable, or my repo blows up. Add your votes for additional features to this issue: https://github.com/ncruces/go-sqlite3/issues/126 https://github.com/ncruces/go-sqlite3/issues/126
- paulclinger 1y agoI have updated the Lua binding to support the session extension (http://lua.sqlite.org/home/timeline?r=session http://lua.sqlite.org/home/timeline?r=session) and it's been integrated into the current version of cosmopolitan/redbean. This was partially done to support application-level sync of SQLite DBs, however this is still a work in progress.
- pdimitar 1y agoWell, my upcoming Elixir wrapper of a Rust wrapper of SQLite (heh, I am aware how it sounds) will support it. I am pretty sure people do find it useful and would use it. If not, the 1-2 days of hobby coding to deliver it are not something I would weep over.
- nickpeterson 1y agoI really wish SQLite had some default way of doing change data capture via session or something similar.