its been the documented/expected behavior since the beginning that subqueries which feature the same table as the enclosing query are automatically correlated. the original idea was that if you wanted a subquery to use the same table without correlation, youd use an alias of that table. later we added "correlate=False". but the notion of "use aliases to isolate instances of a table from itself" has been a theme all along (as it is in regular SQL too).
in fact looking right now it says right in the paragraph there to say "correlate=False" if you dont want this behavior. so people are just not reading the docs in this case. if we change the defaults now, its pretty likely that many existing applications which are using the correlating behavior will break. also, if we split off the correlation of FROM clauses from that of WHERE and column clauses, now we need *two* flags. one to turn *off* correlation of WHERE/column clauses, another to turn *on* correlation of FROM clauses. unless we make "correlate" into a three-state flag (like False, None and True). its also not clear to me if we change this default behavior if all the questions about "where'd my FROM clause go" simply get replaced by an equal number of "why isnt it correlating ?". so the choice is between a slightly quirky but simplistically consistent behavior, versus a backwards-incompatible and more possibly less consistent/more flags behavior. On Mar 22, 2007, at 2:28 PM, Paul Johnston wrote: > > Hi, > >> clearly "correlate=False" has to be more prominently mentioned, not >> just in the FAQ but in the main docs, there should be a section >> specifically on subqueries and their mechanics. >> >> > Could SQLAlchemy deal with this case automatically? > > I think it could. Subqueries that are used in a from clause should not > be correlated, while other subqueries should be. This touches on the > work we're doing on ticket #513. > > Paul > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---