Installation guide

8. Data Types supported by mxODBC
Python Type SQL Type Comments
Server 2008 introduced a date column type.
datetime.time SQL.TIME
Converts the datetime.time instance into a
TIME struct defined by the ODBC standard.
datetime.datetime SQL.TIMESTAMP
Converts the datetime.datetime instance into a
TIMESTAMP struct defined by the ODBC
standard.
Seconds are rounded to the nearest
nanosecond in order to avoid issues with float
second values which sometimes cannot be
represented with full accuracy.
None Any nullable column The Python None singleton is converted to the
special SQL
NULL value.
Any other type SQL.VARCHAR,
SQL.LONGVARCHAR,
SQL.VARBINARY,
SQL.LONGVARBINARY
(char *)
Conversion is done by calling str(variable) and
then passing the resulting string value to the
ODBC driver/manager.
Same notes as for strings apply.
See the ODBC Documentation
and your ODBC driver's documentation for more
information on how these C data types are mapped to SQL column types.
8.5 Output Conversions
The following data types are used per default for output variable:
SQL Type Python Type Comments
SQL.CHAR,
SQL.VARCHAR,
SQL.LONGVARCHAR
(TEXT, BLOB or LONG
in SQL)
String The handling of special characters
depends on the codepage the database
uses.
In
NATIVE
_
UNICODE
_
STRINGFORMAT
and UNICODE_STRINGFORMAT
mode, the string data is converted to a
Python Unicode object based on the
149