]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
remove confusing "with_parent()" from query-enabled properties example
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 13 Sep 2025 13:54:38 +0000 (09:54 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 13 Sep 2025 13:55:14 +0000 (09:55 -0400)
references: #12862
Change-Id: I22ee9fa0c566458a465867e307a77c2eb0ddcdd0

doc/build/orm/join_conditions.rst

index ed7d06c05f95a1ab68e0fa6718a4fa7b361f8360..6c6aba8553d263019772fa90cd9b84dee93e9771 100644 (file)
@@ -1055,7 +1055,14 @@ conjunction with :class:`_query.Query` as follows:
 
         @property
         def addresses(self):
-            return object_session(self).query(Address).with_parent(self).filter(...).all()
+            # query using any kind of filter() criteria
+            return (
+                object_session(self)
+                .query(Address)
+                .filter(Address.user_id == self.id)
+                .filter(...)
+                .all()
+            )
 
 In other cases, the descriptor can be built to make use of existing in-Python
 data.  See the section on :ref:`mapper_hybrids` for more general discussion