Amazon Timestream Write

2020/11/24 - Amazon Timestream Write - 1 updated api methods

Changes  Adds support of upserts for idempotent updates to Timestream.

WriteRecords (updated) Link ΒΆ
Changes (request)
{'CommonAttributes': {'Version': 'long'}, 'Records': {'Version': 'long'}}

The WriteRecords operation enables you to write your time series data into Timestream. You can specify a single data point or a batch of data points to be inserted into the system. 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 data types of the data points you specify when invoking writes into the database. Timestream support eventual consistency read semantics. 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. If you repeat the query request after a short time, the results should return the latest data. Service quotas apply. For more information, see Access Management in the Timestream Developer Guide.

See also: AWS API Documentation

Request Syntax

client.write_records(
    DatabaseName='string',
    TableName='string',
    CommonAttributes={
        'Dimensions': [
            {
                'Name': 'string',
                'Value': 'string',
                'DimensionValueType': 'VARCHAR'
            },
        ],
        'MeasureName': 'string',
        'MeasureValue': 'string',
        'MeasureValueType': 'DOUBLE'|'BIGINT'|'VARCHAR'|'BOOLEAN',
        'Time': 'string',
        'TimeUnit': 'MILLISECONDS'|'SECONDS'|'MICROSECONDS'|'NANOSECONDS',
        'Version': 123
    },
    Records=[
        {
            'Dimensions': [
                {
                    'Name': 'string',
                    'Value': 'string',
                    'DimensionValueType': 'VARCHAR'
                },
            ],
            'MeasureName': 'string',
            'MeasureValue': 'string',
            'MeasureValueType': 'DOUBLE'|'BIGINT'|'VARCHAR'|'BOOLEAN',
            'Time': 'string',
            'TimeUnit': 'MILLISECONDS'|'SECONDS'|'MICROSECONDS'|'NANOSECONDS',
            'Version': 123
        },
    ]
)
type DatabaseName

string

param DatabaseName

[REQUIRED]

The name of the Timestream database.

type TableName

string

param TableName

[REQUIRED]

The name of the Timesream table.

type CommonAttributes

dict

param CommonAttributes

A record containing the common measure and dimension attributes shared across all the records in the request. The measure and dimension attributes specified in here will be merged with the measure and dimension attributes in the records object when the data is written into Timestream.

  • Dimensions (list) --

    Contains the list of dimensions for time series data points.

    • (dict) --

      Dimension represents the meta data attributes of the time series. For example, the name and availability zone of an EC2 instance or the name of the manufacturer of a wind turbine are dimensions.

      • Name (string) -- [REQUIRED]

        Dimension represents the meta data attributes of the time series. For example, the name and availability zone of an EC2 instance or the name of the manufacturer of a wind turbine are dimensions.

        For constraints on Dimension names, see Naming Constraints .

      • Value (string) -- [REQUIRED]

        The value of the dimension.

      • DimensionValueType (string) --

        The data type of the dimension for the time series data point.

  • MeasureName (string) --

    Measure represents the data attribute of the time series. For example, the CPU utilization of an EC2 instance or the RPM of a wind turbine are measures.

  • MeasureValue (string) --

    Contains the measure value for the time series data point.

  • MeasureValueType (string) --

    Contains the data type of the measure value for the time series data point.

  • Time (string) --

    Contains the time at which the measure value for the data point was collected. The time value plus the unit provides the time elapsed since the epoch. For example, if the time value is 12345 and the unit is ms , then 12345 ms have elapsed since the epoch.

  • TimeUnit (string) --

    The granularity of the timestamp unit. It indicates if the time value is in seconds, milliseconds, nanoseconds or other supported values.

  • Version (integer) --

    64-bit attribute used for record updates. Write requests for duplicate data with a higher version number will update the existing measure value and version. In cases where the measure value is the same, Version will still be updated . Default value is to 1.

type Records

list

param Records

[REQUIRED]

An array of records containing the unique dimension and measure attributes for each time series data point.

  • (dict) --

    Record represents a time series data point being written into Timestream. Each record contains an array of dimensions. Dimensions represent the meta data attributes of a time series data point such as the instance name or availability zone of an EC2 instance. A record also contains the measure name which is the name of the measure being collected for example the CPU utilization of an EC2 instance. A record also contains the measure value and the value type which is the data type of the measure value. In addition, the record contains the timestamp when the measure was collected that the timestamp unit which represents the granularity of the timestamp.

    • Dimensions (list) --

      Contains the list of dimensions for time series data points.

      • (dict) --

        Dimension represents the meta data attributes of the time series. For example, the name and availability zone of an EC2 instance or the name of the manufacturer of a wind turbine are dimensions.

        • Name (string) -- [REQUIRED]

          Dimension represents the meta data attributes of the time series. For example, the name and availability zone of an EC2 instance or the name of the manufacturer of a wind turbine are dimensions.

          For constraints on Dimension names, see Naming Constraints .

        • Value (string) -- [REQUIRED]

          The value of the dimension.

        • DimensionValueType (string) --

          The data type of the dimension for the time series data point.

    • MeasureName (string) --

      Measure represents the data attribute of the time series. For example, the CPU utilization of an EC2 instance or the RPM of a wind turbine are measures.

    • MeasureValue (string) --

      Contains the measure value for the time series data point.

    • MeasureValueType (string) --

      Contains the data type of the measure value for the time series data point.

    • Time (string) --

      Contains the time at which the measure value for the data point was collected. The time value plus the unit provides the time elapsed since the epoch. For example, if the time value is 12345 and the unit is ms , then 12345 ms have elapsed since the epoch.

    • TimeUnit (string) --

      The granularity of the timestamp unit. It indicates if the time value is in seconds, milliseconds, nanoseconds or other supported values.

    • Version (integer) --

      64-bit attribute used for record updates. Write requests for duplicate data with a higher version number will update the existing measure value and version. In cases where the measure value is the same, Version will still be updated . Default value is to 1.

returns

None