My apologies; I expressed my question rather incoherently.

if the question is, I want to multiple insert like [{'a':1, 'b':2, 'c':3},
> {'a':2}, {'a':3, 'b':4}], etc. only some dictionaries are missing different
> keys, that is not allowed.   The structure of the SQL statement as parsed by
> MySQL determines for which columns the server-side default is emitted and
> there is only one version of that with an executemany.   So every param
> dictionary must have at least all the keys which the first one does.
>

This was the basic scenario of my question. However, unless I misunderstand,
it does seem to be "allowed": the missing values are replaced with NULL in
the generated query.  But what I actually meant to ask was this: sqlalchemy
handles missing dictionary entries as NULL for the purpose of inserts, is
there an easy way to have it generate a SQL statement with DEFAULT for
missing dictionary entries?

Eg. execute(testtable.insert(), [{'a':1, 'b':2, 'c':3}, {'a':2}, {'a':3,
'b':4}]) => INSERT INTO testtable (a,b,c) VALUES
(1,2,3),(2,DEFAULT,DEFAULT),(3,4,DEFAULT)

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