diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-02-10 16:06:23 -0500 |
---|---|---|
committer | mike bayer <mike_mp@zzzcomputing.com> | 2023-02-16 00:09:14 +0000 |
commit | 18fd19e60d55b35408d94b892e0a2051bcb7ec88 (patch) | |
tree | af402c777c265c841e46147ad309c17671f0e252 /lib/sqlalchemy/sql/_typing.py | |
parent | 8855656626202e541bd2c95bc023e820a022322f (diff) | |
download | sqlalchemy-18fd19e60d55b35408d94b892e0a2051bcb7ec88.tar.gz |
add dataclasses callable and apply annotations more strictly
Added new parameter ``dataclasses_callable`` to both the
:class:`_orm.MappedAsDataclass` class as well as the
:meth:`_orm.registry.mapped_as_dataclass` method which allows an
alternative callable to Python ``dataclasses.dataclass`` to be used in
order to produce dataclasses. The use case here is to drop in Pydantic's
dataclass function instead. Adjustments have been made to the mixin support
added for :ticket:`9179` in version 2.0.1 so that the ``__annotations__``
collection of the mixin is rewritten to not include the
:class:`_orm.Mapped` container, in the same way as occurs with mapped
classes, so that the Pydantic dataclasses constructor is not exposed to
unknown types.
Fixes: #9266
Change-Id: Ia0fab6f20b93a5cb853799dcf1b70a0386837c14
Diffstat (limited to 'lib/sqlalchemy/sql/_typing.py')
0 files changed, 0 insertions, 0 deletions