Hi all,

I am looking for a way to append a child to a tree like structure. I
am using adjacency to represent the tree.

Let's say I have a relationship configured with:

children = relationship(TreeNode,
                                 primaryjoin = "TreeNode.id ==
TreeNode.parent_id",
                                 backref = backref( "parent",
remote_side=[TreeNode.id]),
                                 cascade = "all, delete-orphan",
                                 use_list = True)

and I do:

   t1 = TreeNode()
   t2 = TreeNode(parent = t1)
   t3 = TreeNode(parent = t2)

then i can set:

   t1.parent = t3,

without problem, but:

   t3.children.append(t1)

gives a CircularDependencyError, while i would like this to give the
same result as t1.parent = t3, perhaps by altering the behaviour of
Treenode.children.append.

Am I missing something?
Is there some way to arrange for this?

Cheers, Lars



-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to