On Sun, Feb 9, 2014 at 5:20 AM, Peter Otten <__pete...@web.de> wrote:
>
> The idea here is to wrap the iterable of records to be inserted in the Iter
> class which keeps track of the last accessed row.

You could also use a parameters iterator, e.g. `it = iter(to_db)`.
Then for an IntegrityError, list the remaining records and use that to
infer the last record. This way uses an efficient built-in list
iterator instead of a generator.

http://docs.python.org/3/library/sqlite3#sqlite3.Cursor.executemany

I can't see why the implementation would change in future versions.
Internally it gets an iterator and executes the statement for each
record in a loop. I don't see any point to reading ahead.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to