Python equivalent of perl dbi / DBD :: proxy access? (Perl DBI / DBD :: Proxy for Python)

I have a Perl script that interacts with an existing database (database type unknown) via a DBI module that I would like to get in python 2.6 on WinXP.

Perl code:

use DBI;
my $DSN = "DBI:Proxy:hostname=some.dot.com;port=12345;dsn=DBI:XXXX:ZZZZZ";
my $dbh = DBI->connect($DSN);  

      

Can this be converted to python equivalent?

Following the example ( Is there any documentation available on the pywin32 odbc connector? ) I put together the following:

import odbc
DSN = "DBI:Proxy:hostname=some.dot.com;port=12345;dsn=DBI:XXXX:ZZZZZ"
db = odbc.odbc(DSN)

      

But I am getting error:

dbi.operation-error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified in LOGIN

      

UPDATE

It looks like another Perl module DBD :: Proxy provides the actual interface to the Perl implementation of DBI :: ProxyServer (server side) that handles the actual requests.

Can python be used to interact with Perl-based DBI :: ProxyServer ?

http://metacpan.org/pod/DBD::Proxy

http://hell.org.ua/Docs/oreilly/weblinux/dbi/ch08_02.htm

0


a source to share


2 answers


Your python script doesn't have to be a string translation of your Perl script.

Why not just use a Python DB-API compatible module for the database you want to access? For MySQL, use MySQLdb . For PostgreSQL, use PyGreSQL .



Or search Google for "YourDatabaseName + python"

+5


a source


sqlalchemy is pretty good.



0


a source







All Articles