Hi list!

It's been a long time since I've posted here. SA is still the best
Python ORM; thanks for all your hard work Mike!

Now, the question. I've got a set of related entities:

Order (has items)
Item (has attributes)
Attribute

I am working on optimizing the loading and have run into a situation
that I can't figure out how to make SA optimize. Here's the scenario:

First I load the order (1 query)
Next I load the related items (1 query)
Next I load the related attributes for each item (1 query for each
item)

I have tried eager loading (i.e. setting lazy=False on the
item.attributes relationship), but that generates a HUGE result set
that takes MUCH longer to load than loading the attributes
individually for each item as listed above.

What I'd like to have SA do is do a single query to load all
attributes for all items of the order when the first item's attributes
are requested. Here's the revised scenario from above:

First I load the order (1 query)
Next I load the related items (1 query)
Next I load the related attributes for each item (1 query loads all
attributes for the entire order)

Is this possible or do I have to roll my own extension to orm.relation
(actually orm.properties.PropertyLoader) ? -- that doesn't look very
fun.

~ Daniel
--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to