PEP 249 (database api) -- executemany() with iterable?

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Fri Oct 15 06:20:37 CEST 2010


In message <mailman.1711.1287055174.29448.python-list at python.org>, M.-A. 
Lemburg wrote:

> However, even with iterables, please keep in mind that pushing
> the data row-per-row over a network does not result in good
> performance, so using an iterable will make you update slower.
> 
> cursor.executemany() is meant to allow the database module
> to optimize sending bulk data to the database and ideally,
> it will send the whole sequence to the database in one go.

You seem to be assuming that using an iterator precludes buffering.

What’s wrong with evaluating the iterator to produce as many records as the 
API implementation finds convenient to send at once?



More information about the Python-list mailing list