looking for a good python module for MS SQL server

Frank Millman frank at chagford.com
Tue Nov 1 07:12:44 CET 2005


Anat wrote:
> Hi,
> Does anyone know a good python mudule that works with MS SQL server?
> Thanks,
> Anat

I use the odbc module from pywin32. I believe that it is not 100%
DB-API 2.0 compliant, but it works fine for me. It has the advantage
that if you have installed pywin32 (which is advisable on MSW anyway)
you do not have to install anything else.

I tried adodbapi a few years ago, and it seemed slow in returning
results. I don't know if it has improved in the meantime.

There is one thing I have not figured out how to do with MS-SQL - I
would be interested if anyone has a solution. I use 'scrollable
cursors' a lot. DB-API does not seem to define any methods to
facilitate this, so I construct them and manage them myself with a
series of cur.execute(...) commands. PostgreSQL allows you to 'fetch'
multiple rows at a time. MS-SQL in its normal mode does not. This is
taken from the on-line help -

"Transact-SQL cursors are limited to fetching one row at a time. API
server cursors support fetching blocks of rows with each fetch. A
cursor that supports fetching multiple rows at a time is called a block
cursor."

It goes on to say that API's which support block cursors are OLE DB,
ODBC, ADO, and DB-Library, and that each one has its own syntax.

Do adodbapi, mxODBC, or any other modules allow you to do this?

Thanks

Frank




More information about the Python-list mailing list