stupid Python/database connection
Cameron Laird
claird at lairds.com
Mon Nov 25 14:50:46 EST 2002
In article <f9tE9.53574$744.1962046 at news1.tin.it>,
Alex Martelli <aleax at aleax.it> wrote:
>animeshk wrote:
.
.
.
>> 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?
>
>The general Pythonic way to do that would be, e.g.:
.
.
.
>In this case, you may want to wrap things better than this, since
>differences in SQL dialects and so on do most often need to be smoothed
>away (sigh). But if conditional import and connect calls are all
>you want, that's one way you can get them.
>
>
>Alex
>
Another way: use the ODBC accesses available for both Interbase and Oracle.
Yet another way: if the Interbase and Oracle interfaces don't already con-
form to <URL: http://www.python.org/topics/database/DatabaseAPI-2.0.html >,
you could upgrade them, or hire someone to do so on your behalf.
--
Cameron Laird <Cameron at Lairds.com>
Business: http://www.Phaseit.net
Personal: http://phaseit.net/claird/home.html
More information about the Python-list
mailing list