Re: psycopg2 vs psycopg1: the _v_database_connection problem in Zope 2

"Marco Bizzarri" <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On Wed, Sep 24, 2008 at 9:43 AM, Federico Di Gregorio <fog-NGVKUo/i/[email protected]> wrote:
> Il giorno mer, 24/09/2008 alle 09.39 +0200, Marco Bizzarri ha scritto:
>> On Tue, Sep 23, 2008 at 10:22 AM, Federico Di Gregorio <fog-NGVKUo/i/[email protected]> wrote:
>> Basically, my current choice on this topic is to create a patch to
>> ZPsycopgDA which (more or less):
>>
>> - instead of using an _v_ attribute uses a module level, thread
>> indexed dictionary, storying connections to the database
>> - each time needs a connection gets that from there
>>
>> As usual, I will have to use locks and  try/finally to avoid
>> concurrent access to that, but that's all, more or less.
>>
>> Right?
>
> My suggestion is to switch to psycopg2 and modify the connection pool to
> keep used connections in a dictionary indexed by persistent keys (a
> serial number is fine). Then you store the connection in the _v_
> attribute and the connection index in a persisten attribute. If at any
> time the _v_ attribute does not exists you check the serial number and
> recover the connection from the pool using it. This should work and
> solve all problems.
>
> federico
>

Looks like in the end I have to switch to psycopg2 ;)

Ok, I will do that... I think the planets have the right alignment.

But I do not understand what you're meaning about the persistent
attribute. Can you explain it?

Regards
Marco


-- 
Marco Bizzarri
http://notenotturne.blogspot.com/
http://iliveinpisa.blogspot.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.