On Sep 26, 2007, at 9:28 AM, Barry Hart wrote: > My application has a table of item prices by week. A record is > inserted into a week whenever there is a new, different price. To > find the current price, you have to look backwards in time to the > most recent record. > > I've written some code using SqlAlchemy 0.3.10 to generate a query > like this. The resulting query fails on PostgreSQL because the > innermost query generated by SQLAlchemy is missing a FROM clause. > (SQLite seems happy with it, however.) Is this a bug in SqlAlchemy?
if youre missing a FROM clause, thats a bug. this is usually caused by over-correlation of a select (in 0.4, this shouldnt happen..i.e. the "bug" should be fixed). try setting "correlate=False" on the nested select() statement. Individual correlations to the outside you can then set explicitly using the correlate() method on the select() object. in version 0.4, the API for correlation is a little different and the correlate(), instead of changing the current select(), generates a new select() (also correlate=False is deprecated, calling correlate (None) turns off auto-correlation). --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---