]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
added info about _local_remote_pairs to error message
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 14 Apr 2008 15:54:23 +0000 (15:54 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 14 Apr 2008 15:54:23 +0000 (15:54 +0000)
lib/sqlalchemy/orm/properties.py

index 0eece6466f460c878a8ca6ad4135af66125efbaf..140fffd892183c7021d12eb86bf6ad27198f6fe1 100644 (file)
@@ -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])