More info: Here is a gist showing the
example: https://gist.github.com/Stiivi/4fc4d05ab376f82dca88
Output is:
INSERT INTO data (id, adate, value) VALUES (?, CURRENT_TIMESTAMP, ?), (?,
?, ?)
The second argument in the second record is `?` instead of
`CURRENT_TIMESTAMP`.
s.
On Tuesday, June 3, 2014 5:40:38 PM UTC-4, Stefan Urbanek wrote:
>
> Hi,
>
> I'm trying to multi-insert records which contain a function:
>
> record = {
>
> "some_date": sql.func.now()
>
> key: value, ...
>
> }
>
>
> When I execute table insert with list of records where len(records) > 1
> then I get an error:
>
> “sqlalchemy.exc.ProgrammingError: (ProgrammingError) can't adapt type
> 'now’”
>
>
> I noticed something in the string representation of the statement:
>
> INSERT INTO table (some_date, col1, col2) VALUES (now(), %(col1_0)s,
> %(col2_0)), (%(some_date_1)s, %(col1_1)s, %(col2_1))
>
>
> Note that the first value in the second record is `%(some_date_1)s`
> instead of `now()`
>
> What might be wrong?
>
> Stefan
>
--
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.