Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: MySQL / MariaDB support #312

Open
Saren-Arterius opened this issue Apr 17, 2016 · 6 comments
Open

Request: MySQL / MariaDB support #312

Saren-Arterius opened this issue Apr 17, 2016 · 6 comments

Comments

@Saren-Arterius
Copy link

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.

@yadayada
Copy link
Owner

yadayada commented May 1, 2016

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]

@Thomaseo1
Copy link

Thomaseo1 commented May 28, 2016

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?

@yadayada
Copy link
Owner

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.

@ChlorideCull
Copy link

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?

@yadayada
Copy link
Owner

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.

@yadayada yadayada added this to the 0.3.3 milestone Jun 12, 2016
@yadayada
Copy link
Owner

yadayada commented Oct 9, 2016

For those still interested, please try out the pull request #436.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants