]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
separate out mariadb/mysql implementations but remain monolithic
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 14 Jan 2026 16:06:50 +0000 (11:06 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 16 Jan 2026 21:17:32 +0000 (16:17 -0500)
commit80ced341154d02e0ff56180420905164abd3fba0
tree0f3999ffc5df592ad9d8fe45f545e6364cb3f60a
parenteac5b6771366af7fc0af2b4dd39044a5dc82daeb
separate out mariadb/mysql implementations but remain monolithic

Fixes to the MySQL/MariaDB dialect so that mariadb-specific features such
as the :class:`.mariadb.INET4` and :class:`.mariadb.INET6` datatype may be
used with an :class:`.Engine` that uses a ``mysql://`` URL, if the backend
database is actually a mariadb database.   Previously, support for MariaDB
features when ``mysql://`` URLs were used instead of ``mariadb://`` URLs
was ad-hoc; with this issue resolution, the full set of schema / compiler /
type features are now available regardless of how the URL was presented.

After much discussion it seems premature to formally separate the
mysql/mariadb dialects to be mutually exclusive, however we'd like
to standardize on how dialect-exclusive behaviors are architected.
For now, use an approach of MariaDB "shim" classes which provide
MariaDB behaviors into all relevant MySQL classes up front.  Where
behaviors are mutually exclusive, support `_set_mariadb()` methods
that enable the mariadb version of things.

this approach may or may not have resilience against future
divergences in mysql/mariadb , but at least starts to separate the
source code for the two databases and hopefully provides a clearer
separation of concerns.

Fixes: #13076
Change-Id: I42cffc0563a2c65c38e854e9cc2181353b230c44
13 files changed:
doc/build/changelog/unreleased_21/13076.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/_mariadb_shim.py [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/base.py
lib/sqlalchemy/dialects/mysql/mariadb.py
lib/sqlalchemy/dialects/mysql/mysqlconnector.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/sql/compiler.py
test/dialect/mysql/test_compiler.py
test/dialect/mysql/test_dialect.py
test/dialect/mysql/test_query.py
test/dialect/mysql/test_reflection.py
test/dialect/mysql/test_types.py
test/requirements.py