diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-12-18 15:35:39 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-12-19 09:57:36 -0500 |
| commit | f2b36ede482403a1d7631dca4cf7151898472598 (patch) | |
| tree | b883f680c8ebf3e49b8bc1b2a9f1af94348737e5 /lib/sqlalchemy/orm/decl_base.py | |
| parent | ce8c0013169bdbe377ca21389f85051525814264 (diff) | |
| download | sqlalchemy-f2b36ede482403a1d7631dca4cf7151898472598.tar.gz | |
remove __allow_unmapped__ requirement from dataclasses
Removed the requirement that the ``__allow_unmapped__`` attribute be used
on Declarative Dataclass Mapped class when non-``Mapped[]`` annotations are
detected; previously, an error message that was intended to support legacy
ORM typed mappings would be raised, which additionally did not mention
correct patterns to use with Dataclasses specifically. This error message
is now no longer raised if :meth:`_orm.registry.mapped_as_dataclass` or
:class:`_orm.MappedAsDataclass` is used.
Fixes: #8973
Change-Id: I887afcc2da83dd904444bcb97f31e695b9f8b443
Diffstat (limited to 'lib/sqlalchemy/orm/decl_base.py')
| -rw-r--r-- | lib/sqlalchemy/orm/decl_base.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/decl_base.py b/lib/sqlalchemy/orm/decl_base.py index 797828377..db1fafa4c 100644 --- a/lib/sqlalchemy/orm/decl_base.py +++ b/lib/sqlalchemy/orm/decl_base.py @@ -516,7 +516,7 @@ class _ClassScanMapperConfig(_MapperConfig): self.allow_unmapped_annotations = getattr( self.cls, "__allow_unmapped__", False - ) + ) or bool(self.dataclass_setup_arguments) self.is_dataclass_prior_to_mapping = cld = dataclasses.is_dataclass( cls_ |
