I found a similar thread from about a year ago (http://
groups.google.com/group/sqlalchemy/browse_thread/thread/
66ef04fd10fd2be/ec7784b70abedabe), but it never seemed to answer the
most burning question: is there a way in sqlalchemy to do a multiple
insert with default values for unspecified columns?  One way this
might be possible in SQL is to use the DEFAULT keyword, but I haven't
found anything about it in sqlalchemy.

Below I have SQL that shows:
a) the current response of sqlalchemy to a multiple insert with a row
dict missing a value for a column.
b) the usage of the DEFAULT keyword I am referring to

mysql> create table testytest ( mycol int(11) default 5 );
Query OK, 0 rows affected (0.00 sec)

mysql> insert into testytest (mycol) values (NULL);
Query OK, 1 row affected (0.00 sec)

mysql> insert into testytest (mycol) values (DEFAULT);
Query OK, 1 row affected (0.00 sec)

mysql> insert into testytest (mycol) values (12);
Query OK, 1 row affected (0.00 sec)

mysql> select * from testytest;
+-------+
| mycol |
+-------+
|  NULL |
|     5 |
|    12 |
+-------+
3 rows in set (0.00 sec)

This is trivial seeming in the single insert case, but it seems like
in the multiple insert case, sqlalchemy will require me to use
NULLable columns and ignore defaults.  Am I missing something?

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