From: Mike Bayer Date: Tue, 3 Apr 2012 15:24:16 +0000 (-0400) Subject: then spiff up that error msg X-Git-Tag: rel_0_8_0b1~477^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=35adeb95bf917330e1366f8a7252999419819fb1;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git then spiff up that error msg --- diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py index c1503a79a6..1a6b8a6089 100644 --- a/lib/sqlalchemy/orm/relationships.py +++ b/lib/sqlalchemy/orm/relationships.py @@ -530,8 +530,13 @@ class JoinCondition(object): def _check_remote_side(self): if not self.local_remote_pairs: raise sa_exc.ArgumentError('Relationship %s could ' - 'not determine any local/remote column ' - 'pairs.' + 'not determine any unambiguous local/remote column ' + 'pairs based on join condition and remote_side ' + 'arguments. ' + 'Consider using the remote() annotation to ' + 'accurately mark those elements of the join ' + 'condition that are on the remote side of ' + 'the relationship.' % (self.prop, )) def _check_foreign_cols(self, join_condition, primary): diff --git a/test/orm/test_relationships.py b/test/orm/test_relationships.py index b6f07e5f40..6e610b0cfb 100644 --- a/test/orm/test_relationships.py +++ b/test/orm/test_relationships.py @@ -120,7 +120,12 @@ class _RelationshipErrors(object): assert_raises_message( sa.exc.ArgumentError, "Relationship %s could not determine " - "any local/remote column pairs." % relname, + "any unambiguous local/remote column " + "pairs based on join condition and remote_side arguments. " + r"Consider using the remote\(\) annotation to " + "accurately mark those elements of the join " + "condition that are on the remote side of the relationship." % relname, + fn, *arg, **kw )