]> 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:25 +0000 (09:55 -0400)
references: #12862
Change-Id: I22ee9fa0c566458a465867e307a77c2eb0ddcdd0
(cherry picked from commit 13f569fd615485c50e07f211e37e45d749ccc40d)

doc/build/orm/join_conditions.rst

index 8a220c9d8a1f5ca56d96fd43bc2bcb5eb0eedb3d..c42e2cd337cd9a2063f8f0ff3ac517c960dd0bbd 100644 (file)
@@ -1057,7 +1057,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