summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/properties.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py
index 9c2268e01..3ae0bfbf5 100644
--- a/lib/sqlalchemy/orm/properties.py
+++ b/lib/sqlalchemy/orm/properties.py
@@ -703,6 +703,10 @@ class RelationProperty(StrategizedProperty):
raise sa_exc.ArgumentError("reverse_property %r on relation %s references "
"relation %s, which does not reference mapper %s" % (key, self, other, self.parent))
+ if self.direction in (ONETOMANY, MANYTOONE) and self.direction == other.direction:
+ raise sa_exc.ArgumentError("%s and back-reference %s are both of the same direction %r."
+ " Did you mean to set remote_side on the many-to-one side ?" % (self, other, self.direction))
+
def do_init(self):
self._get_target()
self._process_dependent_arguments()