]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
implement native uuid for mariadb >= 10.7
authorVolodymyr Kochetkov <whysages@gmail.com>
Fri, 26 Jan 2024 15:54:11 +0000 (10:54 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 17 Feb 2024 17:44:38 +0000 (12:44 -0500)
commit49ce2459984266e4ced0562e74a9d3f80677aa39
treea5613b7f1db625f1b58902855aae8e9a8b246c41
parent1c58fe53b6fd069cbb82955ddaf9eb5405076146
implement native uuid for mariadb >= 10.7

Modified the MariaDB dialect so that when using the :class:`_sqltypes.Uuid`
datatype with  MariaDB >= 10.7, leaving the
:paramref:`_sqltypes.Uuid.native_uuid` parameter at its default of True,
the native ``UUID`` datatype will be rendered in DDL and used for database
communication, rather than ``CHAR(32)`` (the non-native UUID type) as was
the case previously.   This is a behavioral change since 2.0, where the
generic :class:`_sqltypes.Uuid` datatype delivered ``CHAR(32)`` for all
MySQL and MariaDB variants.   Support for all major DBAPIs is implemented
including support for less common "insertmanyvalues" scenarios where UUID
values are generated in different ways for primary keys.   Thanks much to
Volodymyr Kochetkov for delivering the PR.

To support this fully without hacks, the mariadb dialect now supports
driver-specific mariadb dialects as well, where we add one here for the
mysqlconnector DBAPI that doesn't accept Python UUID objects, whereas
all the other ones do.

Fixes: #10339
Closes: #10849
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10849
Pull-request-sha: 8490b08713f6c19692b11c084ae38d19e60dd396

Change-Id: Ib920871102b9b64f2cba9697f5cb72b6263e4ed8
doc/build/changelog/unreleased_21/10339.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/mariadb.py
lib/sqlalchemy/dialects/mysql/mariadbconnector.py
lib/sqlalchemy/dialects/mysql/mysqlconnector.py
test/dialect/mysql/test_types.py
test/requirements.py