]> 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:43:30 +0000 (11:43 -0400)
commit041eb04df09b96bae5ef097c479cbee2f4622eca
tree1428bcab8a74272ab1de72015b5c873fb4f9b86c
parent697dcc94e412e013aba298e17613ee097f423e04
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
doc/build/changelog/unreleased_20/11176.rst [new file with mode: 0644]
lib/sqlalchemy/sql/type_api.py
test/sql/test_types.py