[sqlalchemy] Re: Subqueries as secondary tables

2008-12-29 Thread Michael Bayer
On Dec 29, 2008, at 11:01 AM, Alan Shields wrote: So far so good. I've run into one more problem, though. I'm getting: ProgrammingError: (ProgrammingError) subquery in FROM cannot refer to other relations of same query level when I attempt to eagerload('apples'). So, because I can't

[sqlalchemy] Re: Subqueries as secondary tables

2008-12-29 Thread Alan Shields
On Mon, Dec 29, 2008 at 8:45 AM, Michael Bayer mike...@zzzcomputing.com wrote: dkp_pool is not in the outer FROM list because you've set the FROM clause of the outer query to series of joins which do not include that table. From where would you like the max() function to pull its column ?

[sqlalchemy] Re: Subqueries as secondary tables

2008-12-29 Thread Michael Bayer
On Dec 29, 2008, at 1:53 PM, Alan Shields wrote: My apologies, but I don't see what you're saying. I'm a bit confused how pool_table in the run2pool_a subquery is being turned into a subquery as well when there's an eagerload. I dont either since you've only been sending code fragments

[sqlalchemy] Re: Subqueries as secondary tables

2008-12-29 Thread Michael Bayer
First, tell me if the query I've written below is equivalent to what you're trying to select. The basic idea is that the first nested subquery which joins dkp_run to _last_run_date_by_character is not needed. I'm pretty sure this is the case but you have the more ingrained knowledge of

[sqlalchemy] Re: Subqueries as secondary tables

2008-12-29 Thread Michael Bayer
OK, its true the secondary route with relation() is the only one that works with eagerload, the correlation thing was a false start. Attached is a script illustrating both an eager relation(), as well as an explcit Query approach. The usage of declarative is just a typing saver and is not

[sqlalchemy] Re: Subqueries as secondary tables

2008-12-29 Thread Alan Shields
Perfect! Thank you very much. If you're ever in Portland, Oregon, I owe you a drink. Alan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] Re: Subqueries as secondary tables

2008-12-28 Thread Michael Bayer
On Dec 28, 2008, at 9:35 PM, Alan Shields wrote: On Sun, Dec 28, 2008 at 9:29 AM, Michael Bayer mike...@zzzcomputing.com wrote: you'd put primaryjoin=crate_table.c.crate_id==crates2apples.c.some_column inside of the relation().This approach usually makes the eagerload's job easier,