On 18 Sty, 19:47, Michael Bayer <[email protected]> wrote:

> However what I cant figure out with nested sets is, how do I load only  
> the immediate children of a node ?    That is the most common accessor  
> I'd like on a self referential node and I'm not aware of how to do  
> it.   It makes it sort of impossible for there to be a ".children"  
> accessor on a node, unless you load the full subtree and organize.

It is possible if you add a 'depth' column which holds the absolute
distance of the node from the tree root.
Then, in order to load immediate children of a node, we can make a
query:

SELECT * FROM nodes WHERE lft > node.lft and rgt < node.rgt and
depth=node.depth+1


Best regards,
Adam
--~--~---------~--~----~------------~-------~--~----~
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