The foreign key and join condition can be specified as part of the relation definition without having the foreign key existing in the database
class User(Base): __tablename__ = 'users' logon = Column(String(10), primary_key=True) group_id = Column(Integer) class Group(Base): __tablename__ = 'groups' group_id = Column(Integer, primary_key=True) group_nm = Column(String(10)) users = relation('User', backref='grp', primaryjoin='User.group_id==Group.group_id', foreign_keys='User.group_id') -- Mike Conley -- 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.