On May 3, 2010, at 12:18 PM, Jon Nelson wrote:

> On Mon, May 3, 2010 at 11:05 AM, Michael Bayer <mike...@zzzcomputing.com> 
> wrote:
>> you use values() for this:
>> 
>> table.insert().values(col1=foo, col2=3, col3=func.custom_function('cheese'))
>> 
>> if you want bind params:
>> 
>> i = table.insert().values(col3=func.custom_function('mybind'))
>> conn.execute(i, {'col1':'foo', 'col2':3, 'mybind':'cheese'})
>> 
>> note that the name "col3" as a bind param is reserved for the internal use 
>> by the insert() construct.
>> 
>> 
> 
> Sweet! That works perfectly. Thanks!
> Perhaps this could get added to the docs somehow?
> (Like, in the insert() section?)

feel free to submit patches for 
http://www.sqlalchemy.org/docs/sqlexpression.html

usually when people have fully read that tutorial, the idea of values() + 
bindparam() + func. is pretty clear but there is no example for the exact 
pattern above.  





> 
> 
> -- 
> Jon
> 
> -- 
> 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.
> 

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