SQLAlchemy and Mariadb

Hi guys,

I've been writing a small Flask app to track orders and delivery status as a learning experience. I've been using SQL syntax to do CRUD operations on my Mariadb server (hosted on a Pi yay!).

Things were working well till I decided to learn to use SQLAlchemy. I am unable to get my SQLAlchemy connection working using the Mariadb connector. It works if I use it normally.

At this point my SQLAlchemy Database URI is mysql+pymysql:///root:[email protected]/testdatabase

This URI works as long as I install pymysql.

However, I want to use the official python mariadb connector. So I installed the mariadb connector into my venv and changed the database URI to: mariadb+mariadb:///root:[email protected]/testdatabase

When I do this, I get : sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:mariadb.pymysql

Am I missing something here or the mariadb connector isn't compatible with SQLAlchemy?

2 comments · 67% upvoted · other discussions

comments

[deleted]

[removed]

EndUsersarePITA [OP]

Hi and thanks for the reply.

I've looked through that and I realised that the flask-sqlalchemy version in pycharm doesn't use the SQLAlchemy 1.4.0b. So I guess I have to stick to mysql+pymysql for the while.