If I run the SQL command
INSERT INTO my_table VALUES (?);
with the constraint
CREATE my_table(
user_name VARCHAR(255) PRIMARY KEY
);
Using sqlite3's executemany() command on a list ['a', 'b', 'c', 'd', 'e', 'f', 'a', 'b', 'g', 'h', 'i'], I'm going to get a sqlite3.IntegrityError.
I have a few questions about the behavior of executemany() when it encounters this error, and I have been unable to find any documentation on the behavior.
1) Are the values inserted prior to the exception always intact?
2) Are there any cases in which values after the exception occurs might be inserted?
3) Is there any way to determine which value(s) cause an exception? (The best I can think of is to wrap the list in a generator to track the state, log the problem entries, and retry on the rest of the generator until the entire list is consumed.)