pylidc
pylidc copied to clipboard
sqlite database path
Hi!
Thanks for this library -- it has been very useful!!
I was wondering if it is possible to change the path where the sqlite database is stored.
In the current code, the sqlite database is stored in the pylidc installation directory. This means the user must have permissions to write to this directory whenever they import pylidc. However this might not always be the case. For example consider a Dockerfile that looks like this:
USER root
pip install pylidc
USER userA
RUN python -c "import pylidc"
This will fail since userA does not have permissions to write to wherever the root user installed pylidc.
My current workaround is to install pylidc separately for every user. Instead, I was thinking we can change where the sqlite database is stored to a temporary directory like /tmp/pylidc.sqlite?
Thanks again for your help!
Regards, Nand
The sqlalchemy session is set up in pylidc/__init__.py (see _db_path therein). It would be relatively straightforward to make this more flexible by reading the db path from a config file/environment variable or whatever. I don't have time to implement this, but PRs are of course welcome!