From b99f8cad8d290bfa123742eafa9d381cb7644cd1 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 31 Mar 2021 13:16:04 -0400 Subject: Expand sibling tests for overlaps warning Scaled back the warning message added in :ticket:`5171` to not warn for overlapping columns in an inheritance scenario where a particular relationship is local to a subclass and therefore does not represent an overlap. Add errors documentation for the warning and also expand ``util.warn()`` to include a code parameter. Fixes: #6171 Change-Id: Icb1f12d8d645d439ffd2bbb7371c6b00042b6ae3 --- lib/sqlalchemy/orm/relationships.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/orm') diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py index c1fcc63c1..2ed9d859a 100644 --- a/lib/sqlalchemy/orm/relationships.py +++ b/lib/sqlalchemy/orm/relationships.py @@ -364,6 +364,10 @@ class RelationshipProperty(StrategizedProperty): .. versionadded:: 1.4 + .. seealso:: + + :ref:`error_qzyx` - usage example + :param bake_queries=True: Use the :class:`.BakedQuery` cache to cache the construction of SQL used in lazy loads. True by default. Set to False if the @@ -3423,6 +3427,8 @@ class JoinCondition(object): and self.prop.key not in pr._overlaps and not self.prop.parent.is_sibling(pr.parent) and not self.prop.mapper.is_sibling(pr.mapper) + and not self.prop.parent.is_sibling(pr.mapper) + and not self.prop.mapper.is_sibling(pr.parent) and ( self.prop.key != pr.key or not self.prop.parent.common_parent(pr.parent) @@ -3453,7 +3459,8 @@ class JoinCondition(object): "'%s' (copies %s to %s)" % (pr, fr_, to_) for (pr, fr_) in other_props ), - ) + ), + code="qzyx", ) self._track_overlapping_sync_targets[to_][self.prop] = from_ -- cgit v1.2.1