summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-09-11 11:51:44 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-09-11 11:51:44 -0400
commitf98c89d2bee2ae562c79d91aeb96fd55875db917 (patch)
tree32587780d07551d6d092c8740acecdb700042002 /lib/sqlalchemy
parent14d2bb074cccdec32bd26a89353c30fd512b2aa2 (diff)
downloadsqlalchemy-f98c89d2bee2ae562c79d91aeb96fd55875db917.tar.gz
- Fixed warning that would emit when a complex self-referential
primaryjoin contained functions, while at the same time remote_side was specified; the warning would suggest setting "remote side". It now only emits if remote_side isn't present. fixes #3194
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/relationships.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py
index 95ff21444..56a33742d 100644
--- a/lib/sqlalchemy/orm/relationships.py
+++ b/lib/sqlalchemy/orm/relationships.py
@@ -2181,7 +2181,7 @@ class JoinCondition(object):
elif self._local_remote_pairs or self._remote_side:
self._annotate_remote_from_args()
elif self._refers_to_parent_table():
- self._annotate_selfref(lambda col: "foreign" in col._annotations)
+ self._annotate_selfref(lambda col: "foreign" in col._annotations, False)
elif self._tables_overlap():
self._annotate_remote_with_overlap()
else:
@@ -2200,7 +2200,7 @@ class JoinCondition(object):
self.secondaryjoin = visitors.replacement_traverse(
self.secondaryjoin, {}, repl)
- def _annotate_selfref(self, fn):
+ def _annotate_selfref(self, fn, remote_side_given):
"""annotate 'remote' in primaryjoin, secondaryjoin
when the relationship is detected as self-referential.
@@ -2215,7 +2215,7 @@ class JoinCondition(object):
if fn(binary.right) and not equated:
binary.right = binary.right._annotate(
{"remote": True})
- else:
+ elif not remote_side_given:
self._warn_non_column_elements()
self.primaryjoin = visitors.cloned_traverse(
@@ -2240,7 +2240,7 @@ class JoinCondition(object):
remote_side = self._remote_side
if self._refers_to_parent_table():
- self._annotate_selfref(lambda col: col in remote_side)
+ self._annotate_selfref(lambda col: col in remote_side, True)
else:
def repl(element):
if element in remote_side: