Data types

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.

SQLAlchemy

This section documents data types for the CrateDB SQLAlchemy dialect.

Type map

The CrateDB dialect maps between data types like so:

CrateDB

SQLAlchemy

boolean

Boolean

byte

SmallInteger

short

SmallInteger

integer

Integer

long

NUMERIC

float

Float

float_vector

FloatVector

double

DECIMAL

timestamp

TIMESTAMP

string

String

array

ARRAY

object

ObjectType (extension type)

array(object)

ObjectArray (extension type)

geo_point

Geopoint and Geoshape (extension type)

geo_shape

Geopoint and Geoshape (extension type)