On Apr 4, 2014, at 8:08 PM, Jonathan Vanasco <jonat...@findmeon.com> wrote:

> sorry for overload the list with random questions.  i'm trying to get a 
> release out the door and dealing with performance bottlenecks...
> 
> given this setup:
> 
>    class Items2Attributes(base):
>        id
>        item_id
>        condition_id 
>        attribute_id
> 
>     class Items(base):
>        id
>        to_attributes_a = 
> sa.orm.relationship(items.id==Items2Attributes.item_id, 
> Items2Attributes.condition_id=="a")
>        to_attributes_b = 
> sa.orm.relationship(items.id==Items2Attributes.item_id, 
> Items2Attributes.condition_id=="b")
> 
> I achieved a greater performance boost moving 'to_attributes_X' into a 
> subueryload from a joinedload.
> 
> I'm getting a bit of a ding from having 2 subqueryloads though.
> 
> Are there any ways to load both `to_attributes_a` and `to_attributes_b` with 
> a single request ?

yeah, make one relationship and just filter them with a @property for each of 
"a" and "b".  if the object is usually used such that both collections are 
needed, that's the approach.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to