Installation guide

8. Data Types supported by mxODBC
SQL Type Python Type Comments
information.
Default is to return DateTime instances.
SQL.TIME
DateTimeDelta instance or
datetime.time instance or
tocks or
(hour,minute,second) or
String
The type of the return values depends on
the setting of
cursor.datetimeformat and
whether the ODBC driver/manager does
return the value with proper type
information.
Default is to return DateTimeDelta
instances.
SQL.TIMESTAMP
DateTime instance or
datetime.datetime instance or
ticks or
(year,month,day,
hour,minute,second) or
String
The type of the return values depends on
the setting of
cursor.datetimeformat and
whether the ODBC driver/manager does
return the value with proper type
information.
Default is to return DateTime instances.
SQL NULL value None
The Python None singleton is used to
represent the special SQL
NULL value in
Python.
Unsupported Type String mxODBC will try to fetch data from
columns using unsupported SQL data
types as strings.
This is likely to always work but may
cause unwanted conversions and or
truncations or loss of precision.
Output bindings can only be applied using the above mapping by mxODBC if the
database correctly identifies the type of the output variables.
The SQL type given in the above table is also made available though the cursor's
.description tuple as type_code entry (position 1) for result set generating
SQL commands. You can compare this value directly to the appropriate SQL
object values, e.g. test for SQL.CHAR or SQL.VARCHAR.
8.6 Output Type Converter Functions
The last section defined the standard mapping mxODBC applies when fetching
output data from the database.
151