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.
On May 3, 2010, at 10:34 AM, Jon Nelson wrote:
> I have a custom sql function in postgresql that needs to be applied to
> some data that I would like to insert.
> The SQL for this might look like:
>
> INSERT INTO table (col1, col2, col3) VALUES ('foo', 3,
> custom_function('cheese'));
>
> How do I do this with sqlalchemy's lower-level table.insert() support?
>
> I've been using:
>
> conn.execute( table.insert(), **row )
>
>
> --
> Jon
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> 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.
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.