[Twisted-Python] is it possible to change the isolation level of a psycopg2 connection under enterprise.adbapi ?

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Thu Nov 13 11:24:56 MST 2014


On 04:56 pm, twisted-python at 2xlp.com wrote:
>there doesn't seem to be a way to access the connection objects within 
>the pool ( psycopg2 manages this via 
>`connection.set_isolation_level(X)`

Basically.  There is a trick to work around this, invent your own DB-API 
2.0 wrapper around psycopg2 that is a pass-through except that it makes 
this `connection` object call before it gives back a new connection.

You might want to look at twextpy's adbapi2. It provides an interface 
slightly more amenable to customizations like this one. Off the top of 
my head, I don't know if it supports psycopg2 (but I know it supports 
postgresql somehow).

Jean-Paul
>the only workaround I can think of seems to be emitting raw sql when I 
>first start the transaction - but this doesn't seem right.
>
>am i missing anything?
>_______________________________________________
>Twisted-Python mailing list
>Twisted-Python at twistedmatrix.com
>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python




More information about the Twisted-Python mailing list