pyfilesystem2
pyfilesystem2 copied to clipboard
Looking for examples of creating a file system on top of a database backend
I am trying to write a file system layer on data stored in a sqlite3 db. It need only be read-only but I'm having a bit of a time trying to wrap my head around where to start.
Seeing as it's read-only should I just pull all data in from the target table into a mem only db?
Any help being pointed in the right direction would be awesome.
See also #498
I feel like this really depends on your database schema, if you just have a table mapping paths to binary data it's going to be different to a full database storing individual folders and permissions.
Try by first writing an FS subclass and implement the abstract methods on by one, and just raise an error for the writing ones (open in write mode, for instance) if you want it read only first.
You'll find some basic example of using FS on top of Google Cloud Datastore and Google Cloud Firestore at https://github.com/mikespub-org/mp-fs-wsgidav
So it's certainly possible. But this was more a question of "can we do this?" than "should we do this?" :-)
If you're looking for any kind of performance, you might have better luck using FUSE, DBFS, etc. to map a filesystem first, and then use FS in front of it. Or perhaps rethink your approach altogether...