]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
improve support for declared_attr returning ORMDescriptor
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 15 Jun 2023 13:18:38 +0000 (09:18 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 15 Jun 2023 14:38:12 +0000 (10:38 -0400)
commit108f5ec3feed145d371cbd1c54d55d6601bbd0f7
treef42bfac0c8610a2271ce13afbb06ae3ea3a780e2
parent21b2661660132c4258aad18cade78ce0e0539688
improve support for declared_attr returning ORMDescriptor

Fixed issue in ORM Annotated Declarative which prevented a
:class:`_orm.declared_attr` with or without
:attr:`_orm.declared_attr.directive` from being used on a mixin which did
not return a :class:`.Mapped` datatype, and instead returned a supplemental
ORM datatype such as :class:`.AssociationProxy`.  The Declarative runtime
would erroneously try to interpret this annotation as needing to be
:class:`.Mapped` and raise an error.

Fixed typing issue where using the :class:`.AssociationProxy` return type
from a :class:`_orm.declared_attr` function was disallowed.

Fixes: #9957
Change-Id: I797c5bbdb3d1e81a04ed21c6558ec349b970476f
doc/build/changelog/unreleased_20/9957.rst [new file with mode: 0644]
lib/sqlalchemy/ext/associationproxy.py
lib/sqlalchemy/orm/decl_api.py
lib/sqlalchemy/orm/util.py
test/ext/mypy/plain_files/association_proxy_three.py [new file with mode: 0644]
test/orm/declarative/test_tm_future_annotations_sync.py
test/orm/declarative/test_typed_mapping.py