On Oct 26, 5:22 pm, "Michael Bayer" <mike...@zzzcomputing.com> wrote: > K. Wojas wrote: > > address = relation('TestAddress', > > primaryjoin=address_id=='test_address.id', foreign_keys=[address_id]) > > use a real column object here. > Seehttp://www.sqlalchemy.org/trac/wiki/FAQ#ImusingDeclarativeandsettingp....
Putting the entire primaryjoin condition into a string resolved my problem, thanks! Working code as a reference for others: class TestAddress(DeclarativeBase): __tablename__ = 'test_address' id = Column(Integer, primary_key=True) contact_id = Column(Integer, ForeignKey('test_contact.id'), index=True, default=None) contact = relation('TestContact', backref=backref ('other_addresses', order_by=id), primaryjoin="TestAddress.contact_id==TestContact.id") class TestContact(DeclarativeBase): __tablename__ = 'test_contact' id = Column(Integer, primary_key=True) address_id = Column(Integer, ForeignKey('test_address.id'), default=None) address = relation('TestAddress', primaryjoin=address_id==TestAddress.id) Konrad --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---