From: Mike Bayer Date: Thu, 3 Dec 2020 18:01:52 +0000 (-0500) Subject: indicate classically mapped relationship in the dataclass example X-Git-Tag: rel_1_4_0b2~120 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=92a12bcc5112ab27357a82e72af98b459af184a7;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git indicate classically mapped relationship in the dataclass example Change-Id: Id1e3fb660c2aff107aa4a180ba565ee88fa6f56e References: #5027 --- diff --git a/doc/build/orm/mapping_styles.rst b/doc/build/orm/mapping_styles.rst index b889340942..8f281b8114 100644 --- a/doc/build/orm/mapping_styles.rst +++ b/doc/build/orm/mapping_styles.rst @@ -237,6 +237,7 @@ An example of a mapping using ``@dataclass`` is as follows:: from sqlalchemy import String from sqlalchemy import Table from sqlalchemy.orm import registry + from sqlalchemy.orm import relationship mapper_registry = registry() @@ -258,6 +259,11 @@ An example of a mapping using ``@dataclass`` is as follows:: nickname: str = None addresses: List[Address] = field(default_factory=list) + __mapper_args__ = { + "properties" : { + "addresses": relationship("Address") + } + } @mapper_registry.mapped @dataclass