Setting:
1) SQLite3 database file gets uploaded to a fileserver
2) Files get stored into virtual filesystem
3) I want to execute sql queries on that database
Currently I am using go-sqlite3 with a database file located in afero.
Question:
Is there are possbility to load a database file into go-sqlite3 with another source than a file from the os filesystem.
Current approach:
My current solution is to copy the file from afero into the os.TempDir() directory, but that fails with our ci and is no actual solution as it does not use the dedicated filesystem anymore.
After a little source diving I see this in sqlite3.go
So this answers your question, the actual opening of the database happens "outside" Go and "inside" the
sqlite3
library. If we check the functionsqlite3_open_v2
we can see that it requires a file name:I think the only way here is to implement your own Sqlite VFS that somehow interacts with the
afero
abstractions.