Hi all, At work, we've recently been preparing to release a python tool that is built on top of the DB API, but which does not have ties to any particular database. I had expected to be able to use something analogous to the way JDBC allows you to create database connections from a special form of URL to allow us to avoid putting any code into the library that depends on particular databases. Unfortunately the DB API doesn't seem to offer this facility at all.
Looking around I see the sqlobject library has implemented this kind of facility, but it is unfortunately tightly coupled to the rest of that library. It does however show that our tool is not alone in this requirement. I've written a simple factory class that provides the ability to create a database connection from a URL-like string, and written a driver for sqlite, I'll also be writing one for cx_Oracle, but I don't have access to that at home. The code is trivial, but seems to be a decent starting place. The idea is that the main pydb file could be added to the python standard library, with individual database drivers being able to add their own modules to the dbdrivers directory to register themselves with the factory. The code is available at: http://xmelegance.org/downloads/pydbfactory.zip I hope that I might be able to get some feedback. Cheers Rich. _______________________________________________ DB-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/db-sig
