MariaDB driver for Django

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:

  1. Django supports MariaDB > 10.4 version
  2. To use MySQL backend, which is used between the two
  3. 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”

&

  1. “Django provides an adapter for mysqlclient”
  2. “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."

I’m not sure I understand what you’re looking for here.

Quoting directly from the docs:

To use MariaDB, use the MySQL backend, …

I think this is about as direct as it can be.

Also, as you point out, ticket #32705 covers this situation. The status is “wontfix”, which means that right now, nothing is going to change as far as core Django is concerned.

The final post in that ticket says:

It sounds like a third-party database backend is the best way to proceed.

leaving open the possibility of someone putting together a third-party package to directly implement using the MariaDB client. That’s definitely an option for anyone interested enough in the specific feature differences that may exist between those two clients.