From: Mike Bayer Date: Sat, 13 Sep 2025 13:54:38 +0000 (-0400) Subject: remove confusing "with_parent()" from query-enabled properties example X-Git-Tag: rel_2_0_44~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=655d783031995b7c31d60812016cb692b09747dc;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git remove confusing "with_parent()" from query-enabled properties example references: #12862 Change-Id: I22ee9fa0c566458a465867e307a77c2eb0ddcdd0 (cherry picked from commit 13f569fd615485c50e07f211e37e45d749ccc40d) --- diff --git a/doc/build/orm/join_conditions.rst b/doc/build/orm/join_conditions.rst index 8a220c9d8a..c42e2cd337 100644 --- a/doc/build/orm/join_conditions.rst +++ b/doc/build/orm/join_conditions.rst @@ -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