The following table describes the supported SQLite data types and their mapping to the Python data types. The type codes returned in the description
cursor attribute can be used in the addtypecast()
cursor method.
SQLite data type | Type code | Python data type |
---|---|---|
INT8 |
613 |
int |
TINYINT |
606 |
int |
INT2 |
607 |
int |
SMALLINT |
608 |
int |
INT |
609 |
int |
INTEGER |
601 |
int |
MEDIUMINT |
610 |
int |
INT64 |
614 |
int |
BIGINT |
611 |
int |
UNSIGNED BIGINT |
612 |
int |
REAL |
602 |
float |
FLOAT |
618 |
float |
DOUBLE |
619 |
float |
CHAR |
615 |
str |
VARCHAR |
616 |
str |
TEXT |
603 |
str |
DATE |
627 |
datetime.date |
TIME |
628 |
datetime.time |
DATETIME |
629 |
datetime.datetime |
TIMESTAMP |
630 |
datetime.datetime |
BLOB |
604 |
|
BINARY |
604 |
Python Connector for SQLite provides a special data type for fetching columns with optional or user-defined data type names in column definitions.
SQLite data type | Type code | Python data type |
---|---|---|
UNKNOWN |
605 |
str |