From 66f20a8e2069f48665299d1ee220dfe57aedf79e Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 31 May 2024 21:06:08 +0900 Subject: [PATCH] Import all legacy classes by sqlalchemy.orm.collections.* Ensure all of the legacy class names like attribute_mapped_collection are imported by *, instead of only importing the old names partially. Also remove repeated items from __all__ because these are redundant. Fixes: #11435 --- doc/build/changelog/unreleased_20/11435.rst | 6 ++++++ lib/sqlalchemy/orm/collections.py | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 doc/build/changelog/unreleased_20/11435.rst diff --git a/doc/build/changelog/unreleased_20/11435.rst b/doc/build/changelog/unreleased_20/11435.rst new file mode 100644 index 0000000000..68eac703cb --- /dev/null +++ b/doc/build/changelog/unreleased_20/11435.rst @@ -0,0 +1,6 @@ +.. change:: + :tags: bug + :tickets: 11435 + + Fixed some of the legacy class names not imported by + ``sqlalalchemy.orm.collections.*``. diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py index 394a4eaba5..956cbd651a 100644 --- a/lib/sqlalchemy/orm/collections.py +++ b/lib/sqlalchemy/orm/collections.py @@ -148,10 +148,12 @@ __all__ = [ "keyfunc_mapping", "column_keyed_dict", "attribute_keyed_dict", - "column_keyed_dict", - "attribute_keyed_dict", - "MappedCollection", "KeyFuncDict", + # old names in < 2.0 + "mapped_collection", + "column_mapped_collection", + "attribute_mapped_collection", + "MappedCollection", ] __instrumentation_mutex = threading.Lock() -- 2.47.2