> So, what I need is a magic function that takes the query object from:
> 
> User.query.filter(User.x==1, User.y==2, User.z==3)
> 
> And returns something equivalent to:
> 
> User2012.query.filter(User2012.x==1, User2012.y==2, User2012.z==3)
> 
> In simple terms, I need to do a search/replace on the query generated by 
> sqlalchemy before it runs.

why not try something like:

ualias = aliased(User, table_2012)

query(ualias).filter(ualias.x == 1)

or:

query(User).select_from(table_2012)

something like that.

it can’t be 100% transparent, the query needs to be told that its selecting 
from something different.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to