stupid Python/database connection

animeshk animeshk at yahoo.com
Mon Nov 25 12:18:41 EST 2002


This is a really stupid question, I know.

I am trying to write an app that might connect to an Interbase
database or an Oracle database, depending on a configuration file.

I have seen some Python code for interfacing with a database, and it
seems to depend on the import statement.  import some-lib-or-another
to access one kind of database, import some-other-lib-or-another to
access another kind of database.  After the import, it's a matter of
calling that database type's "connect" statement.

So . . . how can the decision of what-database-to-use be defferred to
runtime?  When writing, say, a BDE app in Delphi, it would be a simple
matter of what alias to use.  How is this done in Python?

Thanks!



More information about the Python-list mailing list