Documenting for others a behaviour I found surprising: Database insert for one record eats integrity errors and returns a None key for the inserted record. It doesn't tell you what the integrity problem is (I guess it is ok for code, because there is no reasonable to describe the integrity problem -- but I would appreciate some way to log that for debugging).
Doing a bulk_insert is simply a loop over single insert; that is, if you bulk_insert 10 records and 5 violate integrity, you will have 5 inserted, 5 not inserted, and the return will be a list of 5 new primary keys and 5 None values. I would have expected bulk_insert to either succeed or fail completely, like it usually does in SQL. (This behaviour could be emulated by issuing a db rollback if the return from bulk_insert() contains a Non value). Furthermore, I would have expected it to use a multiple-insert syntax if supported by the back end -- e.g. in MySQL, you can do INSERT INTO *tbl_name* (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9); which is generally faster than multiple individual inserts. However, because of the way bulk_insert is implemented by default, it is impossible for a specific adapter to implement this, because in that case the bulk_insert * does* become an all-or-nothing. I'm a little confused about this, and am therefore avoiding bulk_insert completely.