Please see http://docs.sqlalchemy.org/en/rel_0_9/orm/self_referential.html for special steps to be taken for adjacency list relationships (your answer is in the very first section of this page).
Ed Rahn <edsr...@gmail.com> wrote: > I have the following code: > > class Horse(Base): > __tablename__ = 'horse' > > id = Column(Integer, primary_key=True) > name = Column(String(150), index=True, unique=True) > color = Column(Integer) > sex = Column(Integer) > foaled = Column(Date) > skip = Column(Boolean, default=False) > sire_id = Column(Integer, ForeignKey('horse.id'), index=True) > sire = relationship('Horse', foreign_keys=[sire_id]) > dam_id = Column(Integer, ForeignKey('horse.id'), index=True) > dam = relationship('Horse', foreign_keys=[dam_id]) > state_born_id = Column(Integer, ForeignKey('state.id'), index=True) > race_entries = relationship("RaceEntry", backref='horse', > cascade_backrefs=False) > claims = relationship("ClaimedHorse", backref='horse', > cascade_backrefs=False) > > I am trying to have sire and dam link to Horse > > I get when I run and assign to sire or dam: > TypeError: Incompatible collection type: Horse is not list-like > > > > What's the correct way to do this? > > > thanks, > Ed > > -- > 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/d/optout. -- 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/d/optout.