Re: [sqlalchemy] Unable to multi-insert records with SQL functions

2014-06-04 Thread Stefan Urbanek
On Tuesday, June 3, 2014 10:52:34 PM UTC-4, Michael Bayer wrote: traditional multi-insert is to use executemany() syntax, I’m not sure if sqlite supports values () (), anyway. Not sure about that either. The sqlite example was just quick way how to reproduce something resembling the actual

[sqlalchemy] Unable to multi-insert records with SQL functions

2014-06-03 Thread Stefan Urbanek
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

Re: [sqlalchemy] Unable to multi-insert records with SQL functions

2014-06-03 Thread Michael Bayer
traditional multi-insert is to use executemany() syntax, I'm not sure if sqlite supports values () (), anyway. data = [ {id: 1, value: foo}, {id: 2, value: bar} ] stmt = table.insert().values(adate=sql.func.now()) engine.execute(stmt, data) the func.now() is a constant and the

Re: [sqlalchemy] Unable to multi-insert records with SQL functions

2014-06-03 Thread Michael Bayer
a patch which might make it into 0.9.x or else 1.0 is at https://bitbucket.org/zzzeek/sqlalchemy/issue/3069/multi-valued-insert-isnt-checking which adds this per-value check to every value. On Jun 3, 2014, at 10:52 PM, Michael Bayer mike...@zzzcomputing.com wrote: traditional multi-insert is