title: SQLAlchemy relationship error with one-to-many rel
body: <p>So I have this one-to-many relationship in SQLAlchemy (0.8): </p>
  
  <pre><code>class Parent(Base):
  
      __tablename__ = "parents"
  
      cid = Column(Integer(11), primary_key = True, autoincrement = False)
      uid = Column(Integer(11), ForeignKey('otherTable.uid',
             ondelete = 'CASCADE'), primary_key = True)
      ...
  
      # Relationship with child
      childs_rel = relationship("Child", backref = 'parents', 
                                cascade = "all, delete-orphan")
  </code></pre>
  
  <p>and </p>
  
  <pre><code>class Child(Base):
  
      __tablename__ = "childs"
  
      mid = Column(Integer(11), primary_key = True, autoincrement = False)
      cid = Column(Integer(11), ForeignKey('parents.cid',
             ondelete = 'CASCADE'), primary_key = True)
      uid = Column(Integer(11), ForeignKey('parents.uid',
             ondelete = 'CASCADE'), primary_key = True)
      ...
  </code></pre>
  
  <p>I can create this database, but when I try to manipulate it I get this error:</p>
  
  <blockquote>
    <p>sqlalchemy.exc.AmbiguousForeignKeysError: Could not determine join
    condition between parent/child tables on relationship Parent.childs_rel
    - there are multiple foreign key paths linking the tables.  Specify the 'foreign_keys' argument, providing a list of those columns which
    should be counted as containing a foreign key reference to the parent
    table.</p>
  </blockquote>
  
  <p>I have tried to specify 'foreign_keys' in childs_rel but it sais there is no foreign key in Parent's class, and that is true... that has to be specified in child's class but according to SQLAlchemy's ORM doc, relationship is defined in the "one" in the "one-to-many" rel...</p>
  
  <p><a href="http://docs.sqlalchemy.org/en/rel_0_8/orm/relationships.html#one-to-many" rel="nofollow">http://docs.sqlalchemy.org/en/rel_0_8/orm/relationships.html#one-to-many</a></p>
  
  <p>What do you think that is happening here?
  Thx a lot!</p>