From: BOBOTANG Date: Wed, 4 Sep 2024 18:26:52 +0000 (+0800) Subject: Fix the runtime issue related to the join operation in the association example (... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8dfefb97cd43bc03d202872b99931f61324fe80;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Fix the runtime issue related to the join operation in the association example (#11721) --- diff --git a/examples/association/basic_association.py b/examples/association/basic_association.py index d2271ad430..7a5b46097e 100644 --- a/examples/association/basic_association.py +++ b/examples/association/basic_association.py @@ -105,7 +105,7 @@ if __name__ == "__main__": ) # print customers who bought 'MySQL Crowbar' on sale - q = session.query(Order).join("order_items", "item") + q = session.query(Order).join(OrderItem).join(Item) q = q.filter( and_(Item.description == "MySQL Crowbar", Item.price > OrderItem.price) ) diff --git a/examples/association/proxied_association.py b/examples/association/proxied_association.py index 0ec8fa899a..65dcd6c0b6 100644 --- a/examples/association/proxied_association.py +++ b/examples/association/proxied_association.py @@ -112,7 +112,8 @@ if __name__ == "__main__": # print customers who bought 'MySQL Crowbar' on sale orders = ( session.query(Order) - .join("order_items", "item") + .join(OrderItem) + .join(Item) .filter(Item.description == "MySQL Crowbar") .filter(Item.price > OrderItem.price) )