[sqlalchemy] column_property for correlated subquery

2013-03-18 Thread millerdev
Hi, Using declarative here, and I'm trying to create a column_property with a correlated subquery that returns a count of records with a matching value in some other column. Here's what I've tried. Option 1 is the best, option 2 is ugly but second best, option 3 is not a good option since

[sqlalchemy] Re: column_property for correlated subquery

2013-03-18 Thread millerdev
Forgot to add, I'm on SA 0.7.8 -- 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] Re: Optimizing joined entity loads

2009-06-19 Thread millerdev
Thanks a lot for the tips on how to approach this problem. That's exactly what I needed. in 0.4 you'd get it off the impl (0.5 too, this is just uglier API): Excellent! Here's what I came up with as an initial solution: def poly_load(parent, collection, path): def itersiblings(parent,

[sqlalchemy] Re: Optimizing joined entity loads

2009-06-18 Thread millerdev
I dont really understand the case here. My first example wasn't very good. In an attempt to keep it simple I actually made it too simple. Here's another example: Order (has items) Item (has attributes, has tags) Attribute Tag If I set both Item.attributes and Item.tags to eager-load, then my

[sqlalchemy] Re: Optimizing joined entity loads

2009-06-18 Thread millerdev
Clarification: If I set both Item.attributes and Item.tags to eager-load, then my result set size is the product of len(attributes) * len(tags), which is where the result set becomes HUGE. I jumped right from the eager-load to the completely non-optimized (no eager loading) scenario: This

[sqlalchemy] Re: Optimizing joined entity loads

2009-06-18 Thread millerdev
So this is some variant of, i have a bunch of objects and I'd like to   ... snip lots of reasons why this should not be a standard feature Yeah, I understand what I'm asking for here, and I would never expect this kind of optimization to kick in by default. Instead, it would only be used in