The :ref:`Database API client <connect>` and the :ref:`SQLAlchemy dialect <using-sqlalchemy>` use different Python data types. Consult the corresponding section for further information.
Table of contents
This section documents data types for the CrateDB :ref:`Database API client <connect>`.
Caution!
The CrateDB Database API client implementation is incomplete. For the time being, the client uses native Python types.
In general, types are mapped as follows:
| CrateDB | Python |
|---|---|
| boolean | boolean |
| string | str |
| int | int |
| long | int |
| short | int |
| double | float |
| float | float |
| byte | int |
| geo_point | list |
| geo_shape | dict |
| object | dict |
| array | list |
When writing to CrateDB, the following conversions take place:
| Python | CrateDB |
|---|---|
| Decimal | string |
| date | integer, long, or string |
| datetime | integer, long, or string |
Note
The type that date and datetime objects are mapped depends on the
CrateDB column type.
This section documents data types for the CrateDB :ref:`SQLAlchemy dialect <using-sqlalchemy>`.
The CrateDB dialect maps between data types like so:
| CrateDB | SQLAlchemy |
|---|---|
| boolean | Boolean |
| byte | SmallInteger |
| short | SmallInteger |
| integer | Integer |
| long | NUMERIC |
| float | Float |
| double | DECIMAL |
| timestamp | TIMESTAMP |
| string | String |
| array | ARRAY |
| object | :ref:`object` |nbsp| (extension type) |
| array(object) | :ref:`objectarray` |nbsp| (extension type) |
| geo_point | :ref:`geopoint` |nbsp| (extension type) |
| geo_shape | :ref:`geoshape` |nbsp| (extension type) |