[Zope] use & threadsafety of MySQLdb in Zope if not using DA?
sean.upton@uniontrib.com
sean.upton@uniontrib.com
Mon, 08 Oct 2001 11:07:47 -0700
I am working on a generic toolkit for a user registration system that
requires a toolkit/API for abstracting relational database access to a
MySQL-based user profile database; I do this with a class that handles all
the business logic of my application's core toolkit and data-access
functionality. The toolkit is written in Python using MySQLdb and will be
used by automation utilities, a proxy authorization system, and also within
Zope via a python product I am writing. Since I'm doing this in order to
have a unified API among all my apps using this database, but without the
help of a DA, I'm wondering how I would go about creating a database
connection object via my API in a way that works with Zope. My concerns are:
1 - I don't know how I would instantiate the object within my Zope folderish
container object... The setup is usually simple in Python, I just create
the DB object, which opens the DB connection in its __init__()... I'm
wondering how I could create something like this
2 - I'm not sure how to make this thing thread-safe? I realize that I would
need to deal with the fact that multiple threads of Zope couldn't access/use
the same connection object...
I guess what I am trying to figure out, is how I would have non-persistent
connection objects instantiated for each thread inside Zope upon Zope
startup within my product code. I'm not even sure where to start, or if I'm
going about this the wrong way; I would prefer not to have to rewrite my
data API classes to work with a DA... thoughts?
Sean
=========================
Sean Upton
Senior Programmer/Analyst
SignOnSanDiego.com
The San Diego Union-Tribune
619.718.5241
sean.upton@uniontrib.com
=========================