Database connect / PDO

M.-A. Lemburg mal at
Tue Nov 25 11:43:06 CET 2003

Jon Franz wrote:
> Yes, an underlying DBAPI driver is required, and mxODBC works...
> mostly (see below).
> I might recommend the adodbapi driver for use on the windows platform,
> but that still leaves mxODBC for linux.
> I may be wrong, but I think mxODBC module still doesn't provide all
> the values for the DBAPI .description fields - I know the field name
> is provided, but I don't know if the size info will be correct, or if a
> non-None value will be available for the other attributes.

mxODBC provides all .description values except display_size and
internal_size (and this is allowed by the DB API standard). These
two values are rarely of importance and if you absolutely need them
they can also be queried using the catalog methods the mxODBC exposes.

You should note however, that some ODBC database drivers try
to be smart and "optimize" the return values that you see
in .description (the MyODBC driver is a prominent example).
While this is allowed by the ODBC standard, it is certainly
not good practice.

As a result, the only true source of the schema information
are the catalog methods, e.g. .columns() available in mxODBC.
These also provide much more information than is available in

> Thus, some of the Field object's member variables may be meaningless
> when used with mxODBC on your project.
> Does anyone know offhand when mxODBC will add this info?  I think
> its the last (or one of the few) things holding it back from true DBAPI
> 2.0 compliance.

mxODBC 2.0.x is 100% DB API 2.0 compliant.

The only omissions are .nextset() and .callproc() which will be
available in mxODBC 2.1.0. Both are optional in the DB API 2.0

> ~Jon Franz
> NeuroKode Labs, LLC
> ----- Original Message ----- 
> From: "SectorUnknown" <secun at>
> To: <python-list at>
> Sent: Monday, November 24, 2003 3:47 PM
> Subject: Re: Database connect / PDO
>>I've been looking through the documentation for PDO, but it sounds like
>>you still need mxODBC. Is this correct?
>>In article <mailman.1029.1069699121.702.python-list at>,
>>jfranz at says...
>>>>Another possibility is to see if an OR-thingie like PDO/SQLObject/...
>>>>actually helps for database abstraction. I suppose they'll get really
>>>>"fun" to use once you need advanced queries, though. Does anybody have
>>>>any real-life experience with any of these Python OR mappers?
>>>I have lots of experience with PDO - but it is not an OR mapper.
>>>It's an abstraction layer on top of the DB-API that adds functionality
>>>and attempts to make it easier to write your application to a single
>>>API.  I guess you could say its the n-1th abstraction layer.
>>>PDO might be useful for SectorUnknown's needs.
>>>~Jon Franz
>>>NeuroKode Labs, LLC

Marc-Andre Lemburg

Professional Python Software directly from the Source  (#1, Nov 24 2003)
 >>> Python/Zope Products & Consulting ...
 >>> mxODBC.Zope.Database.Adapter ...   
 >>> mxODBC, mxDateTime, mxTextTools ...

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::

More information about the Python-list mailing list