[DB-SIG] kinterbas db column type

Uwe Grauer mailinglists at onlinehome.de
Wed Nov 26 11:07:45 EST 2003


Gerhard Häring wrote:

> Uwe Grauer wrote:
>
>> Hi,
>>
>> i need to know the database column types returned by kinterbasdb.
>> Implicit type conversion is i nice thing to have, but it hides the 
>> real types in the database.
>> So how could i get this information?
>
>
> Quoting the DB-API 2.0 (http://www.python.org/peps/pep-0249.html):
>
> .description
>
>     This read-only attribute is a sequence of 7-item
>     sequences.  Each of these sequences contains information
>     describing one result column: (name, type_code,
>     display_size, internal_size, precision, scale,
>     null_ok). The first two items (name and type_code) are
>     mandatory, the other five are optional and must be set to
>     None if meaningfull values are not provided.
>
> So you can compare the type_code with the constants in your DB-API 
> module (STRING, NUMBER, ...).
>
> If you need the exact data types of table/view columns, you'll 
> probably need to query database meta tables for this information.
>
> -- Gerhard

I know .description, but my question is specific to the kinterbasedb module.
It's different from other modules cause it does a implicit type
conversion to the Python-types.
So for a DATETIME-column in mysql you get a type_code 12 (which is
indeed DATETIME in MySQLdb) but in kinterbasdb you get  t_tuple. This
does not help me very much since the information i need is different
from what i get.

Uwe





More information about the DB-SIG mailing list