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

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Tue Oct 12 21:01:39 EDT 2010


In message <4cb4ba4e$0$1641$742ec2ed at news.sonic.net>, John Nagle wrote:

> In general, if you find yourself making millions of
> SQL database requests in a loop, you're doing it wrong.

I’ve done this. Not millions, but certainly on the order of tens of 
thousands.

>      Big database loads are usually done by creating a text file
> with the desired data, then using a LOAD DATA INFILE command.

May not always be flexible enough.

> This (in MySQL) is tens to hundreds of times faster than doing individual
> INSERT or UPDATE commands.

Why should that be? The database cannot read a text file any faster than I 
can.



More information about the Python-list mailing list