]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
allow TypeEngine classes to export their repr() parameters
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 22 Feb 2026 21:04:48 +0000 (16:04 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 24 Feb 2026 16:10:52 +0000 (11:10 -0500)
commitd70c040a95cee4f58b109838148a15d18fae8ad6
treed94d8365d7e285989b28ead1314b873ee7484f1c
parent0138954e28096199a3b2fd8553183a599c83cdab
allow TypeEngine classes to export their repr() parameters

Added a new :class:`.GenericRepr` class and :meth:`.TypeEngine.repr_struct`
method to provide better control over type representation. The
:class:`.TypeDecorator` class now properly displays its decorated type's
parameters in its ``__repr__()``, allowing introspection tools and
libraries like Alembic to better understand the structure of decorated
types, in particular for complex "schema" types such as :class:`.Enum` and
:class:`.Boolean`. Type classes can override
:meth:`.TypeEngine.repr_struct` to customize their representation
structure, and the returned :class:`.GenericRepr` object allows for
modifications such as changing the displayed class name.

Fixes: #13140
Change-Id: Ie41d249cfea56686b16c895b74ae03721207170b
doc/build/changelog/unreleased_21/13140.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/enumerated.py
lib/sqlalchemy/dialects/mysql/types.py
lib/sqlalchemy/sql/sqltypes.py
lib/sqlalchemy/sql/type_api.py
lib/sqlalchemy/util/__init__.py
lib/sqlalchemy/util/langhelpers.py
test/sql/test_types.py