Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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



I 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.


Well, 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.


I have updated the Lua binding to support the session extension (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.


There are atleast two SQLite bindings for Go.

https://github.com/crawshaw/sqlite

https://github.com/eatonphil/gosqlite/

Ended up with the latter, but did have to add one function binding in C, to inspect changesets.


I'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


Have you used that? I've read the documentation but I don't think I've ever heard from anyone who uses the extension.


I 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.


I really wish SQLite had some default way of doing change data capture via session or something similar.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: