@groue 👋Have you written anywhere about using multiple databases in GRDB? I’m wondering about shipping a read only db for game content, and creating another for user data like scores, loosely referencing game primary keys in the scores db. Can’t find much prior art, but maybe that because it’s so obvious everyone is doing it and it works fine?
@danhalliday Hi Dan. Sure, you can open as many connections to as many database files as needed, go ahead. I'm not sure many people do it because what's the point unless you really have to? For example I have worked on an app that had two dbs with different levels of Data protection.
@groue Well I was thinking of bundling game data as a sqlite db with the app, so that would be read only and updated frequently as opposed to the user data db. I’d be doing cumbersome language-level querying across both dbs though (eg. get names of games where user has their top 5 scores). Maybe that’s fine though!
@danhalliday Sounds like a valid use case 👍 You can access databases independently, but you can also ATTACH one db to the other: one single connection to both files. There is no high-level GRDB APIs for this SQLite feature, so refer to the SQLite doc: https://www.sqlite.org/lang_attach.html
ATTACH DATABASE

@groue Ah this might be just the ticket, thanks a lot! 🙏