diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-08-10 10:53:11 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-08-16 20:05:32 -0400 |
commit | 6cef8526226ab6033dfef1f793be87bff2160c04 (patch) | |
tree | 693a5b244cbb6f02a78f9d1249e6bd58f90f8bfc /lib/sqlalchemy/orm/__init__.py | |
parent | a134ec1760df6295d537ff63df7aee83d957bf6a (diff) | |
download | sqlalchemy-6cef8526226ab6033dfef1f793be87bff2160c04.tar.gz |
Propagate key for collection events
Added new parameter :paramref:`_orm.AttributeEvents.include_key`, which
will include the dictionary or list key for operations such as
``__setitem__()`` (e.g. ``obj[key] = value``) and ``__delitem__()`` (e.g.
``del obj[key]``), using a new keyword parameter "key" or "keys", depending
on event, e.g. :paramref:`_orm.AttributeEvents.append.key`,
:paramref:`_orm.AttributeEvents.bulk_replace.keys`. This allows event
handlers to take into account the key that was passed to the operation and
is of particular importance for dictionary operations working with
:class:`_orm.MappedCollection`.
Fixes: #8375
Change-Id: Icc472f7c28848f94e15c94a399cc13a88782e1e4
Diffstat (limited to 'lib/sqlalchemy/orm/__init__.py')
-rw-r--r-- | lib/sqlalchemy/orm/__init__.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/__init__.py b/lib/sqlalchemy/orm/__init__.py index cda58d6a5..3a0f425fc 100644 --- a/lib/sqlalchemy/orm/__init__.py +++ b/lib/sqlalchemy/orm/__init__.py @@ -82,6 +82,7 @@ from .interfaces import InspectionAttrInfo as InspectionAttrInfo from .interfaces import MANYTOMANY as MANYTOMANY from .interfaces import MANYTOONE as MANYTOONE from .interfaces import MapperProperty as MapperProperty +from .interfaces import NO_KEY as NO_KEY from .interfaces import ONETOMANY as ONETOMANY from .interfaces import PropComparator as PropComparator from .interfaces import UserDefinedOption as UserDefinedOption |