Re: [Sqlalchemy-users] Correlated subqueries and WHERE

2006-04-16 Thread Robert Leftwich
I wrote: Well, it wasn't the r1256 issue. Your example runs fine, but my code still ends up adding the yearly alias to the FROM of the outer query - obviously, my simple examples 'are not the examples I was looking for' - further investigation required. Ok, found the problem, I was using

Re: [Sqlalchemy-users] Correlated subqueries and WHERE

2006-04-16 Thread Robert Leftwich
On Apr 16, 2006, at 6:33 PM, I wrote: I'll check out further what the problem at my end is (one possibility I've just discovered is that the machine I'm running this on is on an older rev of SA (r1256) - one of the perils of being able to use python setup.py -develop in any checked out r

Re: [Sqlalchemy-users] Correlated subqueries and WHERE

2006-04-16 Thread Michael Bayer
yah i dont like that -develop flag very much, not sure why its so popular. Ben makes it default in the myghty trunk but its not my preference. On Apr 16, 2006, at 6:33 PM, Robert Leftwich wrote: Michael Bayer wrote: this example gives you the output you want. not sure why yours isnt w

Re: [Sqlalchemy-users] Correlated subqueries and WHERE

2006-04-16 Thread Robert Leftwich
Michael Bayer wrote: this example gives you the output you want. not sure why yours isnt working: Thanks a heap for taking the time to work up this example I'll check out further what the problem at my end is (one possibility I've just discovered is that the machine I'm running th

Re: [Sqlalchemy-users] Correlated subqueries and WHERE

2006-04-16 Thread Michael Bayer
robert - this example gives you the output you want. not sure why yours isnt working: from sqlalchemy import * daily = table('daily', column('id'), column('code'), column('date'), ) yearly = table('yearly', column('id'), column('date'), ) yearly_2 = yearly.alia

Re: [Sqlalchemy-users] Correlated subqueries and WHERE

2006-04-16 Thread Robert Leftwich
Michael Bayer wrote: try using the flag "correlate=False" in the Select which you want to be fully self-contained. Unfortunately, I need it to be correlated (it is relative to the current daily date), it just needs its own FROM statement. (also post the full code, since I think using th

Re: [Sqlalchemy-users] Correlated subqueries and WHERE

2006-04-16 Thread Michael Bayer
robert - try using the flag "correlate=False" in the Select which you want to be fully self-contained. (also post the full code, since I think using the alias for the "yearly" table should be working also) On Apr 15, 2006, at 9:43 PM, Robert Leftwich wrote: I'm trying to setup a complica

[Sqlalchemy-users] Correlated subqueries and WHERE

2006-04-15 Thread Robert Leftwich
I'm trying to setup a complicated query that needs to use a correlated subquery in the WHERE clause and I can't find the right incantation for SA to generate the query I want. A simplified example is that I have a table, lets call it 'daily' which has daily entries in it for a number of entiti