]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
annotated / DC forms for association proxy
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 25 Nov 2022 19:29:30 +0000 (14:29 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 30 Nov 2022 00:25:59 +0000 (19:25 -0500)
commit3e3e3ab0d46b8912649afc7c3eb63b76c19d93fe
treef2c5b6fde3c6679138b255056d1b38db2ac67fc6
parent78833af4e650d37e6257cfbb541e4db56e2a285f
annotated / DC forms for association proxy

Added support for the :func:`.association_proxy` extension function to
take part within Python ``dataclasses`` configuration, when using
the native dataclasses feature described at
:ref:`orm_declarative_native_dataclasses`.  Included are attribute-level
arguments including :paramref:`.association_proxy.init` and
:paramref:`.association_proxy.default_factory`.

Documentation for association proxy has also been updated to use
"Annotated Declarative Table" forms within examples, including type
annotations used for :class:`.AssocationProxy` itself.

Also modernized documentation examples in sqlalchemy.ext.mutable,
which was not up to date even for 1.4 style code.

Corrected typing for relationship(secondary) where "secondary"
accepts a callable (i.e. lambda) as well

Fixes: #8878
Fixes: #8876
Fixes: #8880
Change-Id: Ibd4f3591155a89f915713393e103e61cc072ed57
13 files changed:
doc/build/changelog/unreleased_20/8878.rst [new file with mode: 0644]
doc/build/changelog/unreleased_20/8880.rst [new file with mode: 0644]
doc/build/orm/extensions/associationproxy.rst
lib/sqlalchemy/ext/associationproxy.py
lib/sqlalchemy/ext/mutable.py
lib/sqlalchemy/orm/_orm_constructors.py
lib/sqlalchemy/orm/decl_base.py
lib/sqlalchemy/orm/interfaces.py
lib/sqlalchemy/orm/relationships.py
test/ext/mypy/plain_files/association_proxy_two.py [new file with mode: 0644]
test/ext/test_associationproxy.py
test/orm/declarative/test_dc_transforms.py
test/orm/declarative/test_mixin.py