yeah always send us the error message with these since otherwise we have to replicate it , as this mapping looks entirely fine. it asks for a primaryjoin, and additionally the "id" column, until 0.7.0 is released where this has been fixed, is in terms of Node not Department so you have to rename it:
class Department(Node): __tablename__ = 'department' __mapper_args__ = {'polymorphic_identity': 'department'} dept_id = Column("id", Integer, ForeignKey('node.id'), primary_key=True) description = Column(Text) parent_department_id = Column(Integer,ForeignKey('department.id')) parent_department = relationship("Department", backref=backref("subdepartments"), primaryjoin=dept_id==parent_department_id, remote_side=dept_id) On Jan 23, 2011, at 8:55 PM, Michael Naber wrote: > I'm still having trouble getting an adjacency list relationship to > work within a child class (Department class in this example), and am > hoping someone might offer some insight: > > class Node(Base): > __tablename__ = 'node' > id = Column(Integer, primary_key=True) > name = Column(String(100)) > discriminator = Column('discriminator', String(50)) > > class Department(Node): > __tablename__ = 'department' > __mapper_args__ = {'polymorphic_identity': 'department'} > id = Column(Integer, ForeignKey('node.id'), primary_key=True) > description = Column(Text) > parent_department_id = Column(Integer, > ForeignKey('department.id')) > parent_department = relationship("Department", > > backref=backref("subdepartments"), > remote_side=id) > > Thanks, > Michael Naber > > -- > 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. > -- 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.