DSE Graph data types

DSE Graph has many data types that are aligned with CQL data types. For search indexes, see the relationship between DSE Graph and Solr data types.

DSE Graph data types
DSE Graph Data Type Description Schema example

bigint

64-bit signed long

schema.propertyKey('big_number').Bigint().create()

blob

Arbitrary bytes (no validation), expressed as base64 strings

graph.addVertex(T.label, 'answer', 'blob', '42');

schema.propertyKey('serial_string').Blob().create()

boolean

True or false

schema.propertyKey('alive').Boolean().create()

date

Date, in the format of '1940' or '1940-01-01'.

schema.propertyKey('review_date').Date().create()

decimal

Variable-precision decimal

When dealing with currency, DataStax recommends a currency class that serializes to and from an int or use of the decimal data type.

schema.propertyKey('book_price').Decimal().create()

double

64-bit IEEE-754 floating point

schema.propertyKey('stars').Double().create()

duration

Time duration in milliseconds

schema.propertyKey('until').Duration().create()

float

32-bit IEEE-754 floating point

schema.propertyKey('precise').Float().create()

inet

IP address string in IPv4 or IPv6 format, used by the python-cql driver and CQL native protocols

schema.propertyKey('website_ip').Inet().create()

int

32-bit signed integer

schema.propertyKey('age').Int().create()

linestring

Used for geospatial and Cartesian linestrings (double …​. points)

schema.propertyKey('road').Linestring().withGeoBounds().create() (geospatial)

`schema.propertyKey('road').Linestring().withBounds(-1, -1, 1, 1).create() (Cartesian)`

point

Used for geospatial and Cartesian points (double x, double y); note that this corresponds to longitude/latitude, in that order, for mapping geospatial points.

schema.propertyKey('coordinates').Point().withGeoBounds().create() (geospatial)

`schema.propertyKey('coordinates').Point().withBounds(-1, -1, 1, 1).create() (Cartesian)`

polygon

Used for geospatial and Cartesian polygons (double …​. points)

schema.propertyKey('block).Polygon().withGeoBounds().create() (geospatial)

`schema.propertyKey('block').Polygon().withBounds(-1, -1, 1, 1).create() (Cartesian)`

smallint

2 byte integer

schema.propertyKey('age').Smallint().create()

text

String or UTF-8 encoded string

schema.propertyKey('name').Text().create()

time

Time in the format of '10:00:00' or '10:00'.

schema.propertyKey('time').Time().create()

timestamp

Date, or date plus time, encoded as 8 bytes since epoch. The timestamp data type must be specified as a valid DSE database timestamp:

johnDoe.addEdge('rated', beefBourguignon,
  'timestamp', '2014-01-01T00:00:00.00Z',
  'stars', 5,
  'comment', 'Pretty tasty!')

schema.propertyKey('mealCreationDate').Timestamp().create()

uuid

A UUID in standard UUID format or timeuuid format

schema.propertyKey('authorID').Uuid().create()

varint

Arbitrary-precision integer

schema.propertyKey('number').Varint().create()

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com