Psycopg and threads problem

Alban Hertroys alban at magproductions.nl
Tue Sep 21 15:53:14 CEST 2004


Istvan Albert wrote:
> Alban Hertroys wrote:
> 
>> I can't commit until all the data has been inserted and combined. The 
>> commit shouldn't happen until the end of the main thread is reached.
> 
> 
> If you don't commit the inserts you cannot combine them (because they are
> not visible) in a different database connection. I think you should

That's why I use only one DB connection. ;)

> have a commit at the end of your insert threads. That way
> when all the inserts are finished the data will be available
> for the combine thread.
> 
> I might be wrong here but I think all this confusion arises because
> psycopg pools database connections (which is a good thing, it speeds
> up access). But then even when you seemingly open a new connection
> you might be just reusing a db connection from the pool that was
> started (and kept alive) before the inserts took place.

Well, apparently you are :P
Maybe I'm still not clear enough in explaining this 'little' problem of 
mine. The answers I got so far aren't entirely 'on track'.

But thanks anyway.

Alban.



More information about the Python-list mailing list