[DB-SIG] checking column types from cursor object in a database-independent way?

Dan Lenski dlenski at gmail.com
Tue Apr 23 00:24:16 CEST 2013

Michael Bayer <mike_mp <at> zzzcomputing.com> writes:
> On Apr 22, 2013, at 12:44 PM, Dan Lenski <dlenski <at> gmail.com> wrote:
> > I get your point about not crufting up DBAPI with a bunch of high-level 
> > features that will need to be reimplemented for each module...
> > 
> > But this seems to me precisely the kind of feature that *should* exist at 
> > this level, because it makes it easier for higher-level interfaces to 
> > manipulate the underlying database objects in a generic way without 
> > around extra module-dependent state on their own.
> well I will say that there is precedent for this specific request - the 
cursor.connection attribute is part
> of the spec, and is pretty harmless, and the spec also includes the option 
for the DBAPI exception classes
> to be attached onto the Connection, which you can see here:
> http://www.python.org/dev/peps/pep-0249/#optional-db-api-extensions.  If 
we're sticking the
> module-level exception classes directly onto the connection (which I find 
kind of distasteful, but
> there it is), might as well put *all* module-level constants onto it.

Ah yes, that is quite a similar case.

Since DBAPI specifies all these constants at the module-level, why not just 
include connection.module and cursor.module attributes to make them available?

More information about the DB-SIG mailing list