summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGord Thompson <gord@gordthompson.com>2023-04-11 13:56:37 -0600
committerGord Thompson <gord@gordthompson.com>2023-04-11 13:56:37 -0600
commit241ae90fdf73d3d57436b08d354e0e1f2cf644e3 (patch)
tree12795ede6adb45a712fd5c0f05bb07dc8c1348f8
parent6e5ed192c6435ec107eae524bb2c6959c38bc654 (diff)
downloadsqlalchemy-241ae90fdf73d3d57436b08d354e0e1f2cf644e3.tar.gz
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
-rw-r--r--doc/build/orm/extensions/associationproxy.rst5
1 files changed, 4 insertions, 1 deletions
diff --git a/doc/build/orm/extensions/associationproxy.rst b/doc/build/orm/extensions/associationproxy.rst
index fda093272..e612ce1bb 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):