Re: Parallel insert to postgresql with thread

2007-10-26 Thread Laurent Pointal
Le Thu, 25 Oct 2007 13:27:40 +0200, Diez B. Roggisch a écrit : > DB modules aren't necessarily thread-safe. Most of the times, a > connection (and of course their cursor) can't be shared between threads. > > So open a connection for each thread. > > Diez DB modules following DBAPI2 must define

OT Re: Parallel insert to postgresql with thread

2007-10-25 Thread Erik Jones
If you're not Scott Daniels, beware that this conversation has gone horribly off topic and, unless you have an interest in PostreSQL, you may not want to bother reading on... On Oct 25, 2007, at 9:46 PM, Scott David Daniels wrote: > Erik Jones wrote: >> >> On Oct 25, 2007, at 7:28 AM, Scott D

Re: Parallel insert to postgresql with thread

2007-10-25 Thread Scott David Daniels
Erik Jones wrote: > > On Oct 25, 2007, at 7:28 AM, Scott David Daniels wrote: >> Diez B. Roggisch wrote: >>> Abandoned wrote: Hi.. I use the threading module for the fast operation. But >> [in each thread] def save(a,b,c): cursor.execute("INSERT INTO ...

Re: Parallel insert to postgresql with thread

2007-10-25 Thread Erik Jones
On Oct 25, 2007, at 10:12 AM, Jean-Paul Calderone wrote: > On Thu, 25 Oct 2007 09:46:54 -0500, Erik Jones <[EMAIL PROTECTED]> > wrote: >> >> [snip] >> >> Fortunately, in his case, that's not necessarily true. If they do >> all their work with the same connection then, yes, but there are >> othe

Re: Parallel insert to postgresql with thread

2007-10-25 Thread Jean-Paul Calderone
On Thu, 25 Oct 2007 09:46:54 -0500, Erik Jones <[EMAIL PROTECTED]> wrote: > > [snip] > >Fortunately, in his case, that's not necessarily true. If they do >all their work with the same connection then, yes, but there are >other problems with that as mention wrt thread safety and psycopg2. >If he go

Re: Parallel insert to postgresql with thread

2007-10-25 Thread Erik Jones
On Oct 25, 2007, at 7:28 AM, Scott David Daniels wrote: > Diez B. Roggisch wrote: >> Abandoned wrote: >> >>> Hi.. >>> I use the threading module for the fast operation. But > [in each thread] >>> def save(a,b,c): >>> cursor.execute("INSERT INTO ... >>> conn.commit() >

Re: Parallel insert to postgresql with thread

2007-10-25 Thread Scott David Daniels
Diez B. Roggisch wrote: > Abandoned wrote: > >> Hi.. >> I use the threading module for the fast operation. But [in each thread] >> def save(a,b,c): >> cursor.execute("INSERT INTO ... >> conn.commit() >> cursor.execute(...) >> How can i insert data to postgr

Re: Parallel insert to postgresql with thread

2007-10-25 Thread Jean-Paul Calderone
On Thu, 25 Oct 2007 04:00:44 -0700, Abandoned <[EMAIL PROTECTED]> wrote: >Hi.. >I use the threading module for the fast operation. For fast operation, avoid the threading module. Here's a code sample: conn = connect(...) cursor = conn.cursor() cursor.executemany("INSERT INTO keywords

Re: Parallel insert to postgresql with thread

2007-10-25 Thread Diez B. Roggisch
Abandoned wrote: > Hi.. > I use the threading module for the fast operation. But i have some > problems.. > This is my code sample: > = > conn = > psycopg2.connect(user='postgres',password='postgres',database='postgres') > cursor = conn.cursor() > class paralel(Thread): > def _

Parallel insert to postgresql with thread

2007-10-25 Thread Abandoned
Hi.. I use the threading module for the fast operation. But i have some problems.. This is my code sample: = conn = psycopg2.connect(user='postgres',password='postgres',database='postgres') cursor = conn.cursor() class paralel(Thread): def __init__ (self, veriler, sayii):