Heyho! How can I use Declarative to create self-referencing stuff? I'm trying without success to create the tree example (Node with Node.parent and Node.children) in declarative.
The basic table is:
class Node(Base):
__tablename__ = 'nodes'
id = Column(Integer, primary_key = True)
parent_id = Column('parent', Integer, ForeignKey('nodes.id'))
Now I'm struggling with how to add a relation so that I can use
mynode.parent and mynode.children.
I've tried
parent = relation(
'Node', backref=backref('children', remote_side=[Node.id]))
and various variants but always ended up with an exception (different ones
for various cases.)
I guess I have to use remote_side somehow but I couldn't figure how.
cheers
-- vbi
--
featured product: the KDE desktop - http://kde.org
signature.asc
Description: This is a digitally signed message part.
