]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
assign variant mapping on adapt()
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 20 Mar 2024 14:23:41 +0000 (10:23 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 20 Mar 2024 15:42:39 +0000 (11:42 -0400)
commit79879c629354d6a2948e2f296788e5cd47b6d790
tree5ec36b038f082ac64935f9f689259455367ab4aa
parent788e2a13d693435257c5e262acd7b77f319ef8f5
assign variant mapping on adapt()

Fixed regression from the 1.4 series where the refactor of the
:meth:`_types.TypeEngine.with_variant` method introduced at
:ref:`change_6980` failed to accommodate for the ``.copy()`` method, which
will lose the variant mappings that are set up. This becomes an issue for
the very specific case of a "schema" type, which includes types such as
:class:`.Enum` and :class:`.ARRAY`, when they are then used in the context
of an ORM Declarative mapping with mixins where copying of types comes into
play.  The variant mapping is now copied as well.

Fixes: #11176
Change-Id: Icf1a2752f60fce863c87ead8b0fe298b0f3d3766
(cherry picked from commit 29a428955a904e235e1b85e928cbe89155aeca82)
doc/build/changelog/unreleased_20/11176.rst [new file with mode: 0644]
lib/sqlalchemy/sql/type_api.py
test/sql/test_types.py