Writes - Amazon Timestream

Writes

You can collect time series data from connected devices, IT systems, and industrial equipment, and write it into Timestream. Timestream enables you to write data points from a single time series and/or data points from many series in a single write request when the time series belong to the same table. For your convenience, Timestream offers you with a flexible schema that auto detects the column names and data types for your Timestream tables based on the dimension names and the data types of the measure values you specify when invoking writes into the database. You can also write batches of data into Timestream.

Timestream supports the following data types for writes:

Data type Description

BIGINT

Represent a 64-bit integer.

BOOLEAN

Represents the two truth values of logic, namely, true and false.

DOUBLE

64-bit variable-precision implementing the IEEE Standard 754 for Binary Floating-Point Arithmetic.

VARCHAR

Variable length character data with an optional maximum length. The max limit is 2GB.

Note

Timestream supports eventual consistency semantics for reads. This means that when you query data immediately after writing a batch of data into Timestream, the query results might not reflect the results of a recently completed write operation. The results may also include some stale data. Similarly, while writing time series data with one or more new dimensions, a query can return a partial subset of columns for a short period of time. If you repeat theses query requests after a short time, the results should return the latest data.

You can collect time series data from connected devices, IT systems, industrial equipment, and many other systems, and write it into Amazon Timestream. You can write data using the AWS SDKs, AWS CLI, or through AWS Lambda, AWS IoT Core, Amazon Kinesis Data Analytics for Apache Flink, Amazon Kinesis, Amazon MSK and Open source Telegraf.

No upfront schema definition

Before sending data into Amazon Timestream, you must create a database and a table using the AWS Management Console, Timestream’s SDKs, or the Timestream APIs. For more information, see Create a database and Create a table. While creating the table, you do not need to define the schema up front. Amazon Timestream automatically detects the schema based on the measures and dimensions of the data points being sent, so you no longer need to alter your schema offline to adapt it to your rapidly changing time series data.

Writing data (Inserts and Upserts)

The write operation in Amazon Timestream enables you to insert and upsert data. By default, writes in Amazon Timestream follow the first writer wins semantics, where data is stored as append only and duplicate records are rejected. While the first writer wins semantics satisfies the requirements of many time series applications, there are scenarios where applications need to update existing records in an idempotent manner and/or write data with the last writer wins semantics, where the record with the highest version is stored in the service. To address these scenarios, Amazon Timestream provides the ability to upsert data. Upsert is an operation that inserts a record in to the system when the record does not exist or updates the record, when one exists. When the record is updated, it is updated in an idempotent manner.

Batching writes

Amazon Timestream enables you to write data points from a single time series and/or data points from many series in a single write request. Batching multiple data points in a single write operation is beneficial from a performance and cost perspective. See Writes in the Metering and Pricing section for more details.

Note

Your write requests to Timestream may be throttled as Timestream scales to adapt to the data ingestion needs of your application. If your applications encounter throttling exceptions, you must continue to send data at the same (or higher) throughput to allow Timestream to automatically scale to your application's needs.

Eventual consistency for reads

Timestream supports eventual consistency semantics for reads. This means that when you query data immediately after writing a batch of data into Timestream, the query results might not reflect the results of a recently completed write operation. If you repeat these query requests after a short time, the results should return the latest data.