From: Gord Thompson Date: Tue, 11 Apr 2023 19:56:37 +0000 (-0600) Subject: Fix Association Proxy example X-Git-Tag: rel_2_0_10~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=241ae90fdf73d3d57436b08d354e0e1f2cf644e3;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Fix Association Proxy example Minor corrections to "Simplifying Association Objects" example in the Association Proxy docs. https: //github.com/sqlalchemy/sqlalchemy/discussions/9636 Change-Id: Ib433cf78b149d330889d947bbaf2b03c9dd87c29 --- diff --git a/doc/build/orm/extensions/associationproxy.rst b/doc/build/orm/extensions/associationproxy.rst index fda0932721..e612ce1bb6 100644 --- a/doc/build/orm/extensions/associationproxy.rst +++ b/doc/build/orm/extensions/associationproxy.rst @@ -181,6 +181,7 @@ collection of ``User`` to the ``.keyword`` attribute present on each from __future__ import annotations + from typing import List from typing import Optional from sqlalchemy import ForeignKey @@ -213,7 +214,9 @@ collection of ``User`` to the ``.keyword`` attribute present on each keywords: AssociationProxy[List[Keyword]] = association_proxy( "user_keyword_associations", "keyword", - creator=lambda keyword: UserKeywordAssociation(keyword=Keyword(keyword)), + creator=lambda keyword_obj: UserKeywordAssociation( + keyword=keyword_obj + ), ) def __init__(self, name: str):