reidlai at reidlai.com
Fri Jan 31 07:28:40 CET 2003
How can I have a database connection depending on different DBI 2.0
module dynamically? What I want is like following:
a = "DBVendor"
if DBVendor == "PostgreSQL":
from pyPgSQL import PgSQL
connfactory = PgSQL
elsif DBVendor == "Oracle":
from DCOracle2 import *
connfactory = DCOracle2
conn = connfactory.connect(...)
I don't want to have endless if statement to determine DBVendor and know
how to use ConfigParser. But don't know how I can do at import
statement. Thanks for any help.
More information about the Python-list