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

Other MySQL dialects (aside MySQLdb) are not supported #13

Closed
lbeltrame opened this issue Mar 18, 2014 · 4 comments
Closed

Other MySQL dialects (aside MySQLdb) are not supported #13

lbeltrame opened this issue Mar 18, 2014 · 4 comments

Comments

@lbeltrame
Copy link
Contributor

cruzdb hardcodes mysql:// urls in its initialization, therefore any other MySQL dialects different from MySQLdb aren't supported even though SQLalchemy handles them fine.

Related to this is that the engine parameter for Genome is not used at all.

Removing this hardcoded limitation would ease a Python 3 port / support (given that both SQLSoup and SQLalchemy support Python 3).

@brentp
Copy link
Owner

brentp commented Mar 18, 2014

+1. It would be great to have cruzdb support python3. I will work on this at some point. Meanwhile, any pull request would be appreciated.

The Genome.url holds the template for the url. so that can be changed without modifying the code. Then we'd have to adjust create_url to do more careful checking (instead of just mysql:// prefix).

@lbeltrame
Copy link
Contributor Author

The only problem is handling all the combinations that SQLAlchemy supports, IMO.

@brentp
Copy link
Owner

brentp commented Mar 18, 2014

Can just take an extra argument, eg dialect="oursql".

with the Genome.url as: url = "mysql+%(dialect)://%(user)s%(password)s@%(host)s/%(db)s"
with dialect default to mysqldb.

and adjust the matching which is currently:

    if db.startswith(("sqlite://", "mysql://", "postgresql://")):

to use a regexp for all 3 like "^(sqlite|mysql|postgresql)(+[^:]+)://" # untested

@lbeltrame
Copy link
Contributor Author

I'll try to get a PR done, thanks for the suggestions.
What about the unused "engine" parameter?

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

No branches or pull requests

2 participants