Re: [sqlalchemy] How to specify the remote side in a self-referential relationship on one column only?

2011-01-05 Thread Michael Bayer
It is barely possible to do. The usual descriptor approach to an exotic join condition, in case you'd like to keep things simple, is: class Node(Base): @property def children(self): return object_session(self).query(Node).filter(Node.id.like(self.id + '_')).all() Otherwise,

[sqlalchemy] How to specify the remote side in a self-referential relationship on one column only?

2011-01-05 Thread Daniel Gerber
Hi sqlalchemy-group, Is it possible to define a self-referential relationship on a join condition involving the same column on both sides? This: class Node(Base): __tablename__ = 'nodes' id = Column(String(8), primary_key=True) Node2 = aliased(Node) Node.children = relationship(Node2,