summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/__init__.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-02-18 10:05:12 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-05-20 14:19:02 -0400
commita463b1109abb60fc85f8356f30c0351a4e2ed71e (patch)
treede8f96b7bce319fc0f19f56b302202ea3e4e91db /lib/sqlalchemy/orm/__init__.py
parent9e7bed9df601ead02fd96bf2fc787b23b536d2d6 (diff)
downloadsqlalchemy-a463b1109abb60fc85f8356f30c0351a4e2ed71e.tar.gz
implement dataclass_transforms
Implement a new means of creating a mapped dataclass where instead of applying the `@dataclass` decorator distinctly, the declarative process itself can create the dataclass. MapperProperty and MappedColumn objects themselves take the place of the dataclasses.Field object when constructing the class. The overall approach is made possible at the typing level using pep-681 dataclass transforms [1]. This new approach should be able to completely supersede the previous "dataclasses" approach of embedding metadata into Field() objects, which remains a mutually exclusive declarative setup style (mixing them introduces new issues that are not worth solving). [1] https://peps.python.org/pep-0681/#transform-descriptor-types-example Fixes: #7642 Change-Id: I6ba88a87c5df38270317b4faf085904d91c8a63c
Diffstat (limited to 'lib/sqlalchemy/orm/__init__.py')
-rw-r--r--lib/sqlalchemy/orm/__init__.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/__init__.py b/lib/sqlalchemy/orm/__init__.py
index b7d1df532..4f19ba946 100644
--- a/lib/sqlalchemy/orm/__init__.py
+++ b/lib/sqlalchemy/orm/__init__.py
@@ -60,6 +60,7 @@ from .decl_api import DeclarativeBaseNoMeta as DeclarativeBaseNoMeta
from .decl_api import DeclarativeMeta as DeclarativeMeta
from .decl_api import declared_attr as declared_attr
from .decl_api import has_inherited_table as has_inherited_table
+from .decl_api import MappedAsDataclass as MappedAsDataclass
from .decl_api import registry as registry
from .decl_api import synonym_for as synonym_for
from .descriptor_props import Composite as Composite