Background Info/Context:
So I was reading through the Django Documentation, specifically this page that deals with Databases:
I noticed that under MariaDB notes, all that is written is:
- Django supports MariaDB > 10.4 version
- To use MySQL backend, which is used between the two
- To see MySQL notes
However under MySQL notes you see two options:
- mysqlclient
- MySQL Connector/Python
However the curious line to note is that:
“In addition to a DB API driver, Django needs an adapter to access the database drivers from its ORM”
&
- “Django provides an adapter for mysqlclient”
- “while MySQL Connector/Python includes its own”
Main Question
What I’m curious about is if instead of ‘MySQL Connector/Python’ … ‘MariaDB Connector/Python’ would work as well?
I know there is a strong interchangeability between MySQL and MariaDB, but in order to avoid the rare odd issue, since I am using MariaDB itself, I want to use MariaDB Connector/Python as well.
I’m testing it on my own as well, but I was hoping if anyone would share their own experience about this particular driver.
ALSO if the MariaDB Connector/Python is widely known to work (or NOT to work) with Django seamlessly, then I hope the documentation could be updated to reflect the same.
Found this discussion on issues tracker but its from 3 years ago: #32075 (New database backend for MariaDB Connector/Python) – Django
Edit 1:
After installing mysqlclient … I expected that
python -c "import MariaDB"
would work but it doesn’t … however
python -c "import MySQLdb"
works (case sensitive).
Which means that any reference inside the Application Python code would have to use the mysql schema instead of Mariadb
Edit 2: Also found this on MariaDB Jira …
https://jira.mariadb.org/browse/CONPY-121
Notice the comment by someon named Anel Husakovic
" At least it should be mentioned in Django documentation that MariaDB connector/Python can be used in conjunction with mysqlclient, not depending on default-libmysqlclient-dev but on libmariadb-dev."