> -----Original Message-----
> From: sqlalchemy@googlegroups.com 
> [mailto:sqlalch...@googlegroups.com] On Behalf Of Chris Withers
> Sent: 26 January 2010 09:13
> To: sqlalchemy@googlegroups.com
> Subject: [sqlalchemy] any way to "pre cook" a monster query?
> 
> Hi All,
> 
> I have a few monster queries like this:
> 

[SNIP]

> 
> Now, is there any way I can "pre-cook" this (eg: at 
> module-level) such 
> that I can later just plug in self.id and on_date, bind to a 
> session and 
> call .all() on it?
> 
> It seems a bit wasteful to do all the SQL generation on every 
> query when 
> it's almost all identical all the time...
> 
> cheers,
> 
> Chris
> 
> 

I think you can use bind parameter objects for this:

http://www.sqlalchemy.org/docs/sqlexpression.html#bind-parameter-objects

...and use the query's params method to supply the values.

Hope that helps,

Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to