summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/relationships.py9
-rw-r--r--lib/sqlalchemy/util/langhelpers.py5
2 files changed, 12 insertions, 2 deletions
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_
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py
index 51b9071d5..b31f316fe 100644
--- a/lib/sqlalchemy/util/langhelpers.py
+++ b/lib/sqlalchemy/util/langhelpers.py
@@ -1604,13 +1604,16 @@ class _hash_limit_string(compat.text_type):
return hash(self) == hash(other)
-def warn(msg):
+def warn(msg, code=None):
"""Issue a warning.
If msg is a string, :class:`.exc.SAWarning` is used as
the category.
"""
+ if code:
+ msg = "%s %s" % (msg, exc.SQLAlchemyError(msg, code=code)._code_str())
+
warnings.warn(msg, exc.SAWarning, stacklevel=2)