[DB-SIG] kinterbas db column type

Gerhard Häring gh at ghaering.de
Wed Nov 26 10:43:26 EST 2003


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




More information about the DB-SIG mailing list