[Zope] Using Zope pooled connections from Python scripts

Peter Sabaini peter at sabaini.at
Thu Dec 4 06:41:26 EST 2003


completely untested:

da = conn.YourDataBaseAdaptor
conn = da()
resultSet = conn.query(yourSQLString)

look into lib/python/Shared/DC/ZRDB/Connection.py and your DAs 'DA.py'

afaik cursors arent defined in the zope api, ie. you probably could get 
at a cursor but the way to do so is DA-specific

hth,
peter.



Tim Couper wrote:
> Hi
> 
> I'm an experienced Python developer who's looking for
> a Python-compatible web engine for developing apps
> (rather than Apache/mod-python). I've played with Zope
> and it looks like it could well fit the bill :-)
> 
> I have a question about pooled database connections.
> There's a connection object within Zope which is
> useable by ZSQL, which I take to be a pooled
> connection. I'd like to use this same pooled
> connection within a Python Script or Extension. Is
> this possible? I've tried, within a script, to assign
> 
> conn=context.MyConnection
> 
> which does return a connection object, but I can't
> create a cursor on this object. Can I use the
> already-opened connection. Any pointers would be
> appreciated :-)
> 
> Tim
> 
> tim at 2wave.net 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3461 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.zope.org/pipermail/zope/attachments/20031204/add2b61a/smime.bin


More information about the Zope mailing list