]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
implement declared_attr superclass assignment check for dataclasses
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 23 Apr 2021 01:45:10 +0000 (21:45 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 23 Apr 2021 15:02:48 +0000 (11:02 -0400)
commit8bd9d72271ec9a2fec5749c428ef5ad6e9dc2175
treeec9c232830db8c1ccb81cb5df94800334d997cdd
parent8971e27a9b5d1923d36f35c2ba1aaaf46f596308
implement declared_attr superclass assignment check for dataclasses

Adjusted the declarative scan for dataclasses so that the inheritance
behavior of :func:`_orm.declared_attr` established on a mixin, when using
the new form of having it inside of a ``dataclasses.field()`` construct and
not actually a descriptor attribute on the class, correctly accommodates
the case when the target class to be mapped is a subclass of an existing
mapped class which has already mapped that :func:`_orm.declared_attr`, and
therefore should not be re-applied to this class.

Also, as changed in ed3f2c617239668d we now have an "is_dataclass"
boolean set as we iterate through attrs so we can remove this
from declared_attr.

Fixes: #6346
Change-Id: Iec75bdefd3bff7d8a9a157c8dd744ac14ff15ea8
doc/build/changelog/unreleased_14/6346.rst [new file with mode: 0644]
lib/sqlalchemy/orm/decl_api.py
lib/sqlalchemy/orm/decl_base.py
test/orm/test_dataclasses_py3k.py