Creating in-memory DB from a bunch of bytes
(1) By Gonzalo Diethelm (gonzus) on 2021-04-13 12:29:57 [link] [source]
I am creating an SQLite db file with a bunch of data, and uploading that after creation (so, it is properly closed) to an S3 bucket. I can access the bucket and download the contents of the DB, create a temporary file, write the contents there, and open that file as a DB (which will be read-only). Works like a charm but forces me to create that file.
I am wondering if I could skip the process of creating the temporary file, and simply instantiate an in-memory DB with the bytes I got from S3. Is this possible? I could not find any direct API to do this (other than maybe going through the SQLite VFS layer).
Cheers!
(2) By anonymous on 2021-04-13 12:48:54 in reply to 1 [link] [source]
Also litestream for a similar twist.
(3) By Gonzalo Diethelm (gonzus) on 2021-04-13 13:30:20 in reply to 2 [source]
Oh, sqlite3_serialize / sqlite3_deserialize look exactly like what I need. Thanks for the pointers!