Using Zope pooled connections from Python scripts
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@2wave.net ________________________________________________________________________ Download Yahoo! Messenger now for a chance to win Live At Knebworth DVDs http://www.yahoo.co.uk/robbiewilliams
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@2wave.net
participants (2)
-
Peter Sabaini -
Tim Couper