On Apr 30, 1:11 pm, "Gaetan de Menten" <[EMAIL PROTECTED]> wrote:

> There is (at least) one problem remaining though: subqueries do not
> get correlated correctly. This is because the table in the main query
> is aliased and the one in the subquery is not and that the
> "correlator" in the Select class does not recognize an aliased table
> as being the same as the original table.
>
> I see two ways to fix this:
>
> * The first and most easy one is to change the correlator to correlate
> aliased tables with the original ones. Attached is patch which does
> just that. But I highly suspect it's not correct to do that.
>
> * The other option is obviously to aliasize the table in the
> subquery... The problem with that is that the ClauseAdapter in
> sql_util simply doesn't do it... And I didn't see a way to make it do
> it since the "from" objects in a select are pretty much private. Any
> idea?

ticket #52 needs to be implemented first.  the work there is 5% adding
the method, 95% in creating the unit tests so that any changes to
sql.Select in the future dont break the method.

secondly, the "from" list of Select can be affected in two ways, by
adding a FromClause that implements _hide_froms() to "conceal" from
clauses which it replaces, and also by explicitly calling
correlate(from_obj) which is not quite what you need here.  but theres
no reason append_from() cant have a "hides=None" argument added to it
so an external actor can also indicate "FROM object X masks FROM
object Y".  also theres not any huge reason there cant be a
remove_from() either.   looking at the code im seeing some possible
simplifications to the _process_froms() method which might make some
of this easier to see.

the usage of these "from altering" methods in sql_util would all be
just an enhancement to AbstractClauseProcessor who's usage would
become more generalized to be able to process selects and not just
binary/compound clause fragments.  the Aliasizer also i think will
soon be removed in all cases and replaced with ClauseAdapter which is
easier to use.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to