One shot queries (was Re: v1.1 Tonight (no v1.0?))

James William Pye x at jwp.io
Sat Oct 6 08:39:48 UTC 2012


On Oct 5, 2012, at 11:18 PM, Jason Garber <boss at gahooa.com> wrote:
> 322 def Open(*args, **kwargs):
> 323   """A passthru to postgresql.open, which will convert the connection class"""
> 324   conn = postgresql.open(*args, **kwargs)
> 325   Connection.Assume(conn)
> 326   return conn

I don't believe I have documented the following, so your current solution may be more robust across changes:

class MyConnection(postgresql.driver.pq3.Connection):
 …

localdriver = postgresql.driver.pq3.Driver(connection = MyConnection)
C = localdriver.host(user=…,host=…,password=…,database=…) # build Connector
c = C() # connect


More information about the Python-general mailing list