Download mxODBC User Manual

Transcript
8. Data Types supported by mxODBC
Python Type
SQL Type
Comments
set, the .timestampresolution attribute defaults
to 1 nanosecond, so rounding usually is done
to the nearest nanosecond, which is also the
smallest fraction supported by the ODBC
standard.
DateTimeDelta
SQL.TIME
Converts the DateTimeDelta instance into a
TIME struct defined by the ODBC standard.
Fractions of a second will be lost in this
conversion.
datetime.date
SQL.DATE
Converts the datetime.date instance into a
DATE struct defined by the ODBC standard.
Note that some database backends don't
support date column types and give an error
when using datetime.date objects. MS SQL
Server 2000 and 2005 are examples. MS SQL
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
Conversion is done by calling str(variable) and
then passing the resulting string value to the
ODBC driver/manager.
(char *)
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.
123