Request: MySQL / MariaDB support
In some special use case, I have have to share the same database to multiple acd_cli fuse instances. This makes nodes.db crash very often, and if it does, I will have to manually remove nodes.db then $ acd_cli sync. If there is MySQL / MariaDB support, there will not be database crash problem. Thanks.
~~I created a branch that lets you add backends different from sqlite.~~ Update: Please don't use that branch.
CAUTION: work in progress [3rd of May]
In order to decrease time with the database I'm trying to use MySQL, I've installed the cache back ends branch via pip3 install --upgrade git+https://github.com/yadayada/acd_cli.git@cache-backends using default cache.ini settings I get this
sudo acdcli init Traceback (most recent call last): File "/usr/local/bin/acdcli", line 9, in
load_entry_point('acdcli==0.3.1', 'console_scripts', 'acdcli')() File "/usr/local/bin/acd_cli.py", line 1527, in main cache = db.get_cache(CACHE_PATH, SETTINGS_PATH, args.check) File "/usr/local/lib/python3.5/dist-packages/acdcli/cache/db.py", line 46, in get_cache mod = importlib.import_module('..%s.db' % conf['backend']['backend'], name) File "/usr/lib/python3.5/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File " ", line 986, in _gcd_import File " ", line 969, in _find_and_load File " ", line 944, in _find_and_load_unlocked File " ", line 222, in _call_with_frames_removed File " ", line 986, in _gcd_import File " ", line 969, in _find_and_load File " ", line 956, in _find_and_load_unlocked ImportError: No module named 'acdcli.cache.sqlite'
Best guess here seems to be that despite using defaults I'm missing a module named 'acdcli.cache.sqlite' What do I need to change in cache.ini to use MySQL instead of sqlite, and what would that look like?
What do I need to change in cache.ini to use MySQL instead of sqlite, and what would that look like?
First, you set backend=mysql in the [backend] section. You're nearly done now.
Second, write the mysql backend and fix the error you got.
Done.
Using something like PostgreSQL instead of SQLite should be simple, as they are both pretty good at following the SQL standard(s). In fact, SQLite was written based on Postgres documentation, and it's used to make sure SQLite conforms to standards according to a talk by the creator back in 2014. Note that MySQL is pretty bad at this whole standards thing.
It feels kinda dirty to just copy the SQLite backend just so the imported connector can be replaced, and replacing every mention of SQLite with Postgres. What do you think would be a sane way to do it, @yadayada?
What do you think would be a sane way to do it, @yadayada?
I suppose using the SQLAlchemy core as an SQL query builder would be more sensible than having duplicate code.
For those still interested, please try out the pull request #436.