Hi. I am using a self-referential mapper to represent a multi-level
tree of parent-child relationships. Typically I've been querying each
parent for children that I am interested in. Up till now I have made a
new query for each child that I am looking for, which is doesn't seem
like the most efficient way to approach this.

I've found that 0.4's aliased joins are great for selecting parents
based on their children, and can be eager-loaded to grab entire
subtrees with a single query. However each parent in my table can have
many children (and trees can many many levels deep) so eager loading
root nodes can be a bit slow too.

Ideally I would like to be able to eager load only the children that
were involved in the join as those are the only ones that I am
interested in, so that something like:

parent_instance.children

or equivalent, only loads children that were part of the original join
rather than all of parent_instance's children. Is something like this
possible? The closet that I've found is using add_entity after each
join in my query.

Thanks

Stephen

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to