]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Add function mapped_as_dataclass
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 9 Sep 2025 19:16:45 +0000 (15:16 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 10 Sep 2025 18:53:12 +0000 (14:53 -0400)
commitadabce3aa6ce25e785762b5a28a294e9112b03b5
treef0143987ce0c480f023cb7eeffd10cb764d439ae
parent8f7138326cf48a1394417aa492ad083b3400c529
Add function mapped_as_dataclass

Added new decorator :func:`_orm.mapped_as_dataclass`, which is a function
based form of :meth:`_orm.registry.mapped_as_dataclass`; the method form
:meth:`_orm.registry.mapped_as_dataclass` does not seem to be correctly
recognized within the scope of :pep:`681` in recent mypy versions.

The new function is tested and mentioned in the docs, in 2.1 in a
subsequent patch (probably the one that adds unmapped_dataclass also)
we'll switch this new decorator to be the prominent one.

also alphabetize mapping_api.rst.  while the summary box at the top
auto-sorts, have the sidebar alpha also, it's kind of weird how
these were in no order at all

Fixes: #12855
Change-Id: If98724fd466004ec4c8a312a0cbf1c934a6ce9e3
doc/build/changelog/unreleased_20/12855.rst [new file with mode: 0644]
doc/build/orm/dataclasses.rst
doc/build/orm/mapping_api.rst
lib/sqlalchemy/orm/__init__.py
lib/sqlalchemy/orm/decl_api.py
test/orm/declarative/test_dc_transforms.py
test/orm/declarative/test_dc_transforms_future_anno_sync.py
test/typing/plain_files/orm/dataclass_transforms_decorator.py [new file with mode: 0644]