Skip to content

Latest commit

 

History

History
105 lines (84 loc) · 4.38 KB

File metadata and controls

105 lines (84 loc) · 4.38 KB

Data types

The data types of the :ref:`CrateDB DBAPI database API client <connect>`.

Database API client

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 to, depends on the CrateDB column type.

Note

When using date or datetime objects with timezone information, the value is implicitly converted to a Unix time (epoch) timestamp, i.e. the number of seconds which have passed since 00:00:00 UTC on Thursday, 1 January 1970.

This means, when inserting or updating records using timezone-aware Python date or datetime objects, timezone information will not be preserved. If you need to store it, you will need to use a separate column.