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

Michael Bayer mike_mp at zzzcomputing.com
Tue Apr 23 16:41:00 CEST 2013


On Apr 23, 2013, at 3:29 AM, M.-A. Lemburg <mal at egenix.com> wrote:

> 
> 
> A method doing the lookup via the sys.modules dictionary
> could resolve those issues:
> 
> database = connection.database()
> try:
>    cursor = connection.cursor()
>    cursor.execute(...)
> except database.DataError:
>    ...
> 
> Thoughts ?


we probably want to call it "module" or "namespace" or "api" or something like that.   The method itself can be a Python @property which would cause it to behave like an attribute in any case, or if we want to keep it as a method call to make it clear that code is being executed, that's fine as well.    But the spec would need to say in either case, "don't assign the module itself to the connection".




More information about the DB-SIG mailing list