diff options
Diffstat (limited to 'lib/sqlalchemy/orm/properties.py')
| -rw-r--r-- | lib/sqlalchemy/orm/properties.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py index 0eece6466..140fffd89 100644 --- a/lib/sqlalchemy/orm/properties.py +++ b/lib/sqlalchemy/orm/properties.py @@ -566,8 +566,12 @@ class PropertyLoader(StrategizedProperty): "For more relaxed rules on join conditions, the relation may be marked as viewonly=True." % (self.primaryjoin, self) ) else: - raise exceptions.ArgumentError("Could not determine relation direction for primaryjoin condition '%s', on relation %s. " - "Specify the foreign_keys argument to indicate which columns on the relation are foreign." % (self.primaryjoin, self)) + if arg_foreign_keys: + raise exceptions.ArgumentError("Could not determine relation direction for primaryjoin condition '%s', on relation %s. " + "Specify _local_remote_pairs=[(local, remote), (local, remote), ...] to explicitly establish the local/remote column pairs." % (self.primaryjoin, self)) + else: + raise exceptions.ArgumentError("Could not determine relation direction for primaryjoin condition '%s', on relation %s. " + "Specify the foreign_keys argument to indicate which columns on the relation are foreign." % (self.primaryjoin, self)) self.foreign_keys = util.OrderedSet([r for l, r in eq_pairs]) self._opposite_side = util.OrderedSet([l for l, r in eq_pairs]) |
