Skip to main content
Skip table of contents

Collection support for time series data

Supported features

  • Convert a collection to a hypertable and update its properties

  • Ability to drop chunks from a hypertable

  • Support for data retention policies

  • JS API

Hypertables

You can now convert an existing collection with data to a hypertable or create a new collection and convert it to a hypertable. A time-based column (integer or datetime-based) must be added to your collection before converting it to a hypertable. Hypertable properties need to be set to complete the conversion:

CODE
{
  "time_column": <string>, // required
  "chunk_time_interval": { "interval_string": <string> }, // required
  "migrate_data": <bool>, // required
  "data_retention_policy": { "interval_string": <string> } // optional
}
  • The time_column represents the time column name in the collection.

  • The interval_string in the chunk_time_interval can be of the format `x second(s)/minute(s)/day(s)/month(s)/year(s). For example: “1 day”, “5 months”, “4 days”, “2 years”, etc.

  • The migrate_data must be true for collections with existing data and false otherwise.

  • You are not required to set a data retention policy, so this field can be omitted if required. The interval_string can be of the format `x second(s)/minute(s)/day(s)/month(s)/year(s).

Endpoints:

CODE
/api/v/4/collection/{systemKey}/{collectionName}/hypertable
  • POST, PUT, and DELETE supported

  • Dev and user supported

The POST method will convert a collection to a hypertable and needs the hypertable properties in the body. Example POST body:

CODE
{
  "time_column": "create_date",
  "chunk_time_interval": { "interval_string": "7 days" },
  "migrate_data": false,
  "data_retention_policy": { "interval_string": "1 month" }
}

The PUT method is used to update the hypertable properties. Only the chunk_time_interval and data_retention_policy can be updated. If updating both, the PUT body needs both in the object or just one if updating one property.

The DELETE method is used to drop chunks of data from the hypertable. The DELETE body:

CODE
{
  "older_than": { "interval_string": <string> } // required
  "newer_than": { "interval_string": <string> } // optional
}

Both params need to be in the interval format mentioned above.

JS API

Three new functions:

  • Fetch aggregate data

  • Drop chunks

  • Bulk insert

Details will be updated @ https://github.com/ClearBlade/native-libraries

If frequent inserts on a hypertable are needed, the bulk insert API is highly recommended because it is 100x faster than normal inserts.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.