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

2010-10-16 Thread Martin Gregorie
On Sun, 17 Oct 2010 11:27:17 +1300, Lawrence D'Oliveiro wrote: > In message , Martin Gregorie wrote: > >> On Thu, 14 Oct 2010 16:36:34 +1300, Lawrence D'Oliveiro wrote: >> >>> In message <4cb5e659$0$1650$742ec...@news.sonic.net>, John Nagle >>> wrote: >>> Also note that there are some

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

2010-10-16 Thread Lawrence D'Oliveiro
In message , Martin Gregorie wrote: > On Thu, 14 Oct 2010 16:36:34 +1300, Lawrence D'Oliveiro wrote: > >> In message <4cb5e659$0$1650$742ec...@news.sonic.net>, John Nagle wrote: >> >>> Also note that there are some issues with doing a huge volume of >>> updates in one MySQL InnoDB transacti

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

2010-10-15 Thread Lawrence D'Oliveiro
In message , Steve Howell wrote: > On Oct 13, 8:32 pm, Lawrence D'Oliveiro > wrote: > >> In message >> , Steve >> Howell wrote: >> >>> Bulk-load strategies usually solve one or more of these problems: >> >>> network latency >> >> That’s not an issue. This is a bulk operation, after all. >> >>> i

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

2010-10-14 Thread Lawrence D'Oliveiro
In message , 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 op

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

2010-10-14 Thread Steve Howell
On Oct 13, 8:32 pm, Lawrence D'Oliveiro wrote: > In message > , Steve > > Howell wrote: > > Bulk-load strategies usually solve one or more of these problems: > > >  network latency > > That’s not an issue. This is a bulk operation, after all. > > >  index maintenance during the upload > > There ar

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

2010-10-14 Thread Martin Gregorie
On Thu, 14 Oct 2010 16:36:34 +1300, Lawrence D'Oliveiro wrote: > In message <4cb5e659$0$1650$742ec...@news.sonic.net>, John Nagle wrote: > >> Also note that there are some issues with doing a huge volume of >> updates in one MySQL InnoDB transaction. The system has to keep the >> data neede

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

2010-10-14 Thread M.-A. Lemburg
Terry Reedy wrote: > On 10/12/2010 11:10 AM, Roy Smith wrote: >> PEP 249 says about executemany(): >> >> Prepare a database operation (query or command) and then >> execute it against all parameter sequences or mappings >> found in the sequence seq_of_parameters. >> >> ar

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

2010-10-13 Thread Lawrence D'Oliveiro
In message <4cb5e659$0$1650$742ec...@news.sonic.net>, John Nagle wrote: > Also note that there are some issues with doing a huge volume of > updates in one MySQL InnoDB transaction. The system has to keep the > data needed to undo the updates, and there's a limit on the amount of > pending t

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

2010-10-13 Thread Lawrence D'Oliveiro
In message , Steve Howell wrote: > Bulk-load strategies usually solve one or more of these problems: > > network latency That’s not an issue. This is a bulk operation, after all. > index maintenance during the upload There are usually options to temporarily turn this off. > parsing of the

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

2010-10-13 Thread John Nagle
On 10/12/2010 6:01 PM, Lawrence D'Oliveiro wrote: In message<4cb4ba4e$0$1641$742ec...@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

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

2010-10-13 Thread Steven D'Aprano
On Wed, 13 Oct 2010 14:01:39 +1300, Lawrence D'Oliveiro wrote: > In message <4cb4ba4e$0$1641$742ec...@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 certa

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

2010-10-13 Thread J. Gerlach
Am 13.10.2010 14:26, schrieb Jon Clements: > On 12 Oct, 20:21, "J. Gerlach" wrote: >> Am 12.10.2010 17:10, schrieb Roy Smith: >> >>> [A]re there any plans to update the api to allow an iterable instead of >>> a sequence? >> >> [sqlite3 example snipped] > > What happens if you do itertools.repeat(

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

2010-10-13 Thread Jon Clements
On 12 Oct, 20:21, "J. Gerlach" wrote: > Am 12.10.2010 17:10, schrieb Roy Smith: > > > [A]re there any plans to update the api to allow an iterable instead of > > a sequence? > > sqlite3 (standard library, python 2.6.6., Windows 32Bit) does that already:: > > import sqlite3 as sql > > connection =

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

2010-10-12 Thread Steve Howell
On Oct 12, 6:01 pm, Lawrence D'Oliveiro wrote: > In message <4cb4ba4e$0$1641$742ec...@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 orde

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

2010-10-12 Thread Lawrence D'Oliveiro
In message <4cb4ba4e$0$1641$742ec...@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 us

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

2010-10-12 Thread John Nagle
On 10/12/2010 11:35 AM, Jon Clements wrote: On 12 Oct, 18:53, Jon Clements wrote: On 12 Oct, 18:32, Roy Smith wrote: On Oct 12, 1:20 pm, Jon Clements wrote: On 12 Oct, 16:10, Roy Smith wrote: PEP 249 says about executemany(): Prepare a database operation (query or comma

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

2010-10-12 Thread J. Gerlach
Am 12.10.2010 17:10, schrieb Roy Smith: > [A]re there any plans to update the api to allow an iterable instead of > a sequence? sqlite3 (standard library, python 2.6.6., Windows 32Bit) does that already:: import sqlite3 as sql connection = sql.connect(":memory:") cursor = connection.execute(""

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

2010-10-12 Thread Petite Abeille
On Oct 12, 2010, at 8:35 PM, Jon Clements wrote: > 4) Execute an update with a from statement joining your main table and > temp table (pretty sure that's ANSI standard, and DB's should support > it -- embedded one's may not though, but if you're dealing with 1mil > records, I'm taking a guess yo

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

2010-10-12 Thread Antoine Pitrou
On Tue, 12 Oct 2010 13:58:37 -0400 Terry Reedy wrote: > On 10/12/2010 11:10 AM, Roy Smith wrote: > > PEP 249 says about executemany(): > > > > Prepare a database operation (query or command) and then > > execute it against all parameter sequences or mappings > > found in

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

2010-10-12 Thread Jon Clements
On 12 Oct, 18:53, Jon Clements wrote: > On 12 Oct, 18:32, Roy Smith wrote: > > > > > On Oct 12, 1:20 pm, Jon Clements wrote: > > > > On 12 Oct, 16:10, Roy Smith wrote: > > > > > PEP 249 says about executemany(): > > > > >         Prepare a database operation (query or command) and then > > > >

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

2010-10-12 Thread Ned Deily
In article <2eeb1c54-83f5-4375-93fb-478bdbd7e...@j25g2000yqa.googlegroups.com>, Jon Clements wrote: > On 12 Oct, 18:32, Roy Smith wrote: > > On Oct 12, 1:20 pm, Jon Clements wrote: > > > > > On 12 Oct, 16:10, Roy Smith wrote: > > > > > > PEP 249 says about executemany(): > > > > > >        

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

2010-10-12 Thread Terry Reedy
On 10/12/2010 11:10 AM, Roy Smith wrote: PEP 249 says about executemany(): Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters. are there any plans to update the api to

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

2010-10-12 Thread Jon Clements
On 12 Oct, 18:32, Roy Smith wrote: > On Oct 12, 1:20 pm, Jon Clements wrote: > > > On 12 Oct, 16:10, Roy Smith wrote: > > > > PEP 249 says about executemany(): > > > >         Prepare a database operation (query or command) and then > > >         execute it against all parameter sequences or map

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

2010-10-12 Thread Roy Smith
On Oct 12, 1:20 pm, Jon Clements wrote: > On 12 Oct, 16:10, Roy Smith wrote: > > > PEP 249 says about executemany(): > > >         Prepare a database operation (query or command) and then > >         execute it against all parameter sequences or mappings > >         found in the sequence seq_of_p

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

2010-10-12 Thread Jon Clements
On 12 Oct, 16:10, Roy Smith wrote: > PEP 249 says about executemany(): > >         Prepare a database operation (query or command) and then >         execute it against all parameter sequences or mappings >         found in the sequence seq_of_parameters. > > are there any plans to update the api

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

2010-10-12 Thread Roy Smith
PEP 249 says about executemany(): Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters. are there any plans to update the api to allow an iterable instead of a sequence? --