On Aug 28, 2013, at 11:48 PM, gbr <[email protected]> wrote:

> to compile the WHERE clause of "query" means we look at "query.c.id" which 
> means we must render the table "query" which is how it cycles.    
> 
> Why does it need to compile the whole query when I just want to use than 
> column name of the query?
>  
> What it seems like you're looking to do is where(location.c.id < 100).
> 
> Correct. Unfortunately, I don't have access to `location.c.id`. The query is 
> generated and just returned as an object. All I can do to alter it, is by 
> using attributes of `query`. Is there any way of using the columns without 
> triggering a complete compilation of `query`?


OK well "compilation" means, "we turn it into a string when you pass it to 
execute()", and obviously that has to go completely.  the issue isn't that we 
need to skip anything, it's that query.c.id is not the Column object you're 
looking for.

if you really wanted to get at that location.c.id and you really don't have the 
table or anything being passed, well it would be a lot better to alter that, 
but otherwise you could perhaps dig into froms like this:

my_table = s.froms[0]
s.append_whereclause(my_table.c.id)

that will work, it's just brittle, if your select() is against more than one 
Table, or a join, or something like that, your target table would probably no 
longer be as easy as s.froms[0].

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to