I'm trying to do something like this:
class Animal(Base):
__tablename__ = 'animals'
id_ = Column(Integer, primary_key=True)
sire_id = Column(Integer, ForeignKey('animals.id_'))
dam_id = Column(Integer, ForeignKey('animals.id_'))
sire = relationship('Animal', foreign_keys=[sire_id])
dam = relationship('Animal', foreign_keys=[dam_id])
children = relationship('Animal', foreign_keys=[sire_id, dam_id])
It gives:
sqlalchemy.exc.AmbiguousForeignKeysError: Could not determine join condition
between parent/child tables on relationship Animal.first_owner - 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.
I've spent lots of time here, but I'm just not seeing the answer for this
father-mother-children relationship.
http://docs.sqlalchemy.org/en/rel_0_9/orm/relationships.html
Any help?
Thanks,
Michael
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.