]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
add RegistryEvents
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 31 Aug 2025 22:53:01 +0000 (18:53 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 19 Sep 2025 17:09:08 +0000 (13:09 -0400)
commit8488cc7aa64281ebe9c4af7881a5ff668737a345
treeb3de01b325201c1bf4626992bc145e6b76c62958
parent0d72cc8fc35b7d8aacbbb93422e4f76052c507c9
add RegistryEvents

Added :class:`_orm.RegistryEvents` event class that allows event listeners
to be established on a :class:`_orm.registry` object. The new class
provides three events: :meth:`_orm.RegistryEvents.resolve_type_annotation`
which allows customization of type annotation resolution that can
supplement or replace the use of the
:paramref:`.registry.type_annotation_map` dictionary, including that it can
be helpful with custom resolution for complex types such as those of
:pep:`695`, as well as :meth:`_orm.RegistryEvents.before_configured` and
:meth:`_orm.RegistryEvents.after_configured`, which are registry-local
forms of the mapper-wide version of these hooks.

note this change was prematurely merged in 7111dc0cbaae and reverted
for re-review and additional changes.

Fixes: #9832
(cherry picked from commit 7111dc0cbaae2070173e9f4a054745ee7d036dfa)
Change-Id: I8d69f5c7e0d004f98b7449fefe87a03bb0f29e39
15 files changed:
doc/build/changelog/migration_21.rst
doc/build/changelog/unreleased_21/9832.rst [new file with mode: 0644]
doc/build/orm/declarative_tables.rst
doc/build/orm/events.rst
lib/sqlalchemy/ext/declarative/extensions.py
lib/sqlalchemy/orm/__init__.py
lib/sqlalchemy/orm/decl_api.py
lib/sqlalchemy/orm/events.py
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/properties.py
lib/sqlalchemy/orm/util.py
lib/sqlalchemy/sql/sqltypes.py
lib/sqlalchemy/sql/type_api.py
lib/sqlalchemy/util/typing.py
test/orm/test_events.py