Installation guide
5. mxODBC Overview
5. mxODBC Overview
mxODBC is structured as Python package to support interfaces to many different
ODBC managers and drivers. Each of these interfaces is accessible as subpackage
of the
mx.ODBC Python package, e.g. on Windows you'd normally use the
mx.ODBC.Windows subpackage to access the Windows ODBC manager; on Unix
this would typically be the
mx.ODBC.iODBC, mx.ODBC.unixODBC or the
mx.ODBC.DataDirect package depending on which of these Unix ODBC
managers you have installed.
Each of these subpackages behaves as if it were a separate Python database
interface, so you actually get more than just one interface with mxODBC. The
advantage over other Python database interfaces is that all subpackages share the
same logic and programming interfaces, so you don't have to change your
application logic when moving from one subpackage to another. This enables
programs to run (more or less) unchanged on Windows and Unix, for example.
As you may know, there is a standard for Python database interfaces, the Python
Database API Specification or Python DB-API for short. Marc-André Lemburg, the
author of the mxODBC package, is the editor of this specification, so great care is
taken to make mxODBC as compatible to the Python DB-API as possible.
5.1 mxODBC and the Python Database API
Specification
The mxODBC package tries to adhere to the Python DB API Version 2.0 in most
details. Many features of the old Python DB API 1.0
are still supported to maintain
backwards compatibility and simplify porting old Python applications to the new
interface.
5.1.1 Differences
Here is a list of minor differences between mxODBC and the DB API 2.0
specifications:
•
cursor.description doesn't return display_size and internal_size; both
values are always
None, since this information is not readily available
through ODBC interfaces used for result set processing, the information
can be expensive to determine and the values are not commonly used in
applications. If you do need to access this information, you can use the
cursor.getcolattribute() method with info ids
SQL.DESC_DISPLAY_SIZE and SQL.DESC_OCTET_LENGTH.
63