TimestreamWrite

Table of Contents

Client

class TimestreamWrite.Client

A low-level client representing Amazon Timestream Write

Amazon Timestream is a fast, scalable, fully managed time-series database service that makes it easy to store and analyze trillions of time-series data points per day. With Timestream, you can easily store and analyze IoT sensor data to derive insights from your IoT applications. You can analyze industrial telemetry to streamline equipment management and maintenance. You can also store and analyze log data and metrics to improve the performance and availability of your applications.

Timestream is built from the ground up to effectively ingest, process, and store time-series data. It organizes data to optimize query processing. It automatically scales based on the volume of data ingested and on the query volume to ensure you receive optimal performance while inserting and querying data. As your data grows over time, Timestream’s adaptive query processing engine spans across storage tiers to provide fast analysis while reducing costs.

import boto3

client = boto3.client('timestream-write')

These are the available methods:

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
close()

Closes underlying endpoint connections.

create_batch_load_task(**kwargs)

Creates a new Timestream batch load task. A batch load task processes data from a CSV source in an S3 location and writes to a Timestream table. A mapping from source to target is defined in a batch load task. Errors and events are written to a report at an S3 location. For the report, if the KMS key is not specified, the batch load task will be encrypted with a Timestream managed KMS key located in your account. For more information, see Amazon Web Services managed keys. Service quotas apply. For details, see code sample.

See also: AWS API Documentation

Request Syntax

response = client.create_batch_load_task(
    ClientToken='string',
    DataModelConfiguration={
        'DataModel': {
            'TimeColumn': 'string',
            'TimeUnit': 'MILLISECONDS'|'SECONDS'|'MICROSECONDS'|'NANOSECONDS',
            'DimensionMappings': [
                {
                    'SourceColumn': 'string',
                    'DestinationColumn': 'string'
                },
            ],
            'MultiMeasureMappings': {
                'TargetMultiMeasureName': 'string',
                'MultiMeasureAttributeMappings': [
                    {
                        'SourceColumn': 'string',
                        'TargetMultiMeasureAttributeName': 'string',
                        'MeasureValueType': 'DOUBLE'|'BIGINT'|'BOOLEAN'|'VARCHAR'|'TIMESTAMP'
                    },
                ]
            },
            'MixedMeasureMappings': [
                {
                    'MeasureName': 'string',
                    'SourceColumn': 'string',
                    'TargetMeasureName': 'string',
                    'MeasureValueType': 'DOUBLE'|'BIGINT'|'VARCHAR'|'BOOLEAN'|'TIMESTAMP'|'MULTI',
                    'MultiMeasureAttributeMappings': [
                        {
                            'SourceColumn': 'string',
                            'TargetMultiMeasureAttributeName': 'string',
                            'MeasureValueType': 'DOUBLE'|'BIGINT'|'BOOLEAN'|'VARCHAR'|'TIMESTAMP'
                        },
                    ]
                },
            ],
            'MeasureNameColumn': 'string'
        },
        'DataModelS3Configuration': {
            'BucketName': 'string',
            'ObjectKey': 'string'
        }
    },
    DataSourceConfiguration={
        'DataSourceS3Configuration': {
            'BucketName': 'string',
            'ObjectKeyPrefix': 'string'
        },
        'CsvConfiguration': {
            'ColumnSeparator': 'string',
            'EscapeChar': 'string',
            'QuoteChar': 'string',
            'NullValue': 'string',
            'TrimWhiteSpace': True|False
        },
        'DataFormat': 'CSV'
    },
    ReportConfiguration={
        'ReportS3Configuration': {
            'BucketName': 'string',
            'ObjectKeyPrefix': 'string',
            'EncryptionOption': 'SSE_S3'|'SSE_KMS',
            'KmsKeyId': 'string'
        }
    },
    TargetDatabaseName='string',
    TargetTableName='string',
    RecordVersion=123
)
Parameters
  • ClientToken (string) -- This field is autopopulated if not provided.
  • DataModelConfiguration (dict) --
    • DataModel (dict) --
      • TimeColumn (string) --

        Source column to be mapped to time.

      • TimeUnit (string) --

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

      • DimensionMappings (list) -- [REQUIRED]

        Source to target mappings for dimensions.

        • (dict) --
          • SourceColumn (string) --
          • DestinationColumn (string) --
      • MultiMeasureMappings (dict) --

        Source to target mappings for multi-measure records.

        • TargetMultiMeasureName (string) --
        • MultiMeasureAttributeMappings (list) -- [REQUIRED]
          • (dict) --
            • SourceColumn (string) -- [REQUIRED]
            • TargetMultiMeasureAttributeName (string) --
            • MeasureValueType (string) --
      • MixedMeasureMappings (list) --

        Source to target mappings for measures.

        • (dict) --
          • MeasureName (string) --
          • SourceColumn (string) --
          • TargetMeasureName (string) --
          • MeasureValueType (string) -- [REQUIRED]
          • MultiMeasureAttributeMappings (list) --
            • (dict) --
              • SourceColumn (string) -- [REQUIRED]
              • TargetMultiMeasureAttributeName (string) --
              • MeasureValueType (string) --
      • MeasureNameColumn (string) --
    • DataModelS3Configuration (dict) --
      • BucketName (string) --
      • ObjectKey (string) --
  • DataSourceConfiguration (dict) --

    [REQUIRED]

    Defines configuration details about the data source for a batch load task.

    • DataSourceS3Configuration (dict) -- [REQUIRED]

      Configuration of an S3 location for a file which contains data to load.

      • BucketName (string) -- [REQUIRED]

        The bucket name of the customer S3 bucket.

      • ObjectKeyPrefix (string) --
    • CsvConfiguration (dict) --

      A delimited data format where the column separator can be a comma and the record separator is a newline character.

      • ColumnSeparator (string) --

        Column separator can be one of comma (','), pipe ('|), semicolon (';'), tab('/t'), or blank space (' ').

      • EscapeChar (string) --

        Escape character can be one of

      • QuoteChar (string) --

        Can be single quote (') or double quote (").

      • NullValue (string) --

        Can be blank space (' ').

      • TrimWhiteSpace (boolean) --

        Specifies to trim leading and trailing white space.

    • DataFormat (string) -- [REQUIRED]

      This is currently CSV.

  • ReportConfiguration (dict) --

    [REQUIRED]

    Report configuration for a batch load task. This contains details about where error reports are stored.

    • ReportS3Configuration (dict) --

      Configuration of an S3 location to write error reports and events for a batch load.

      • BucketName (string) -- [REQUIRED]
      • ObjectKeyPrefix (string) --
      • EncryptionOption (string) --
      • KmsKeyId (string) --
  • TargetDatabaseName (string) --

    [REQUIRED]

    Target Timestream database for a batch load task.

  • TargetTableName (string) --

    [REQUIRED]

    Target Timestream table for a batch load task.

  • RecordVersion (integer) --
Return type

dict

Returns

Response Syntax

{
    'TaskId': 'string'
}

Response Structure

  • (dict) --

    • TaskId (string) --

      The ID of the batch load task.

Exceptions

  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.ConflictException
  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.ServiceQuotaExceededException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
create_database(**kwargs)

Creates a new Timestream database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. For more information, see Amazon Web Services managed keys. Service quotas apply. For details, see code sample.

See also: AWS API Documentation

Request Syntax

response = client.create_database(
    DatabaseName='string',
    KmsKeyId='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
Parameters
  • DatabaseName (string) --

    [REQUIRED]

    The name of the Timestream database.

  • KmsKeyId (string) -- The KMS key for the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. For more information, see Amazon Web Services managed keys.
  • Tags (list) --

    A list of key-value pairs to label the table.

    • (dict) --

      A tag is a label that you assign to a Timestream database and/or table. Each tag consists of a key and an optional value, both of which you define. With tags, you can categorize databases and/or tables, for example, by purpose, owner, or environment.

      • Key (string) -- [REQUIRED]

        The key of the tag. Tag keys are case sensitive.

      • Value (string) -- [REQUIRED]

        The value of the tag. Tag values are case-sensitive and can be null.

Return type

dict

Returns

Response Syntax

{
    'Database': {
        'Arn': 'string',
        'DatabaseName': 'string',
        'TableCount': 123,
        'KmsKeyId': 'string',
        'CreationTime': datetime(2015, 1, 1),
        'LastUpdatedTime': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • Database (dict) --

      The newly created Timestream database.

      • Arn (string) --

        The Amazon Resource Name that uniquely identifies this database.

      • DatabaseName (string) --

        The name of the Timestream database.

      • TableCount (integer) --

        The total number of tables found within a Timestream database.

      • KmsKeyId (string) --

        The identifier of the KMS key used to encrypt the data stored in the database.

      • CreationTime (datetime) --

        The time when the database was created, calculated from the Unix epoch time.

      • LastUpdatedTime (datetime) --

        The last time that this database was updated.

Exceptions

  • TimestreamWrite.Client.exceptions.ConflictException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.ServiceQuotaExceededException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
create_table(**kwargs)

Adds a new table to an existing database in your account. In an Amazon Web Services account, table names must be at least unique within each Region if they are in the same database. You might have identical table names in the same Region if the tables are in separate databases. While creating the table, you must specify the table name, database name, and the retention properties. Service quotas apply. See code sample for details.

See also: AWS API Documentation

Request Syntax

response = client.create_table(
    DatabaseName='string',
    TableName='string',
    RetentionProperties={
        'MemoryStoreRetentionPeriodInHours': 123,
        'MagneticStoreRetentionPeriodInDays': 123
    },
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    MagneticStoreWriteProperties={
        'EnableMagneticStoreWrites': True|False,
        'MagneticStoreRejectedDataLocation': {
            'S3Configuration': {
                'BucketName': 'string',
                'ObjectKeyPrefix': 'string',
                'EncryptionOption': 'SSE_S3'|'SSE_KMS',
                'KmsKeyId': 'string'
            }
        }
    }
)
Parameters
  • DatabaseName (string) --

    [REQUIRED]

    The name of the Timestream database.

  • TableName (string) --

    [REQUIRED]

    The name of the Timestream table.

  • RetentionProperties (dict) --

    The duration for which your time-series data must be stored in the memory store and the magnetic store.

    • MemoryStoreRetentionPeriodInHours (integer) -- [REQUIRED]

      The duration for which data must be stored in the memory store.

    • MagneticStoreRetentionPeriodInDays (integer) -- [REQUIRED]

      The duration for which data must be stored in the magnetic store.

  • Tags (list) --

    A list of key-value pairs to label the table.

    • (dict) --

      A tag is a label that you assign to a Timestream database and/or table. Each tag consists of a key and an optional value, both of which you define. With tags, you can categorize databases and/or tables, for example, by purpose, owner, or environment.

      • Key (string) -- [REQUIRED]

        The key of the tag. Tag keys are case sensitive.

      • Value (string) -- [REQUIRED]

        The value of the tag. Tag values are case-sensitive and can be null.

  • MagneticStoreWriteProperties (dict) --

    Contains properties to set on the table when enabling magnetic store writes.

    • EnableMagneticStoreWrites (boolean) -- [REQUIRED]

      A flag to enable magnetic store writes.

    • MagneticStoreRejectedDataLocation (dict) --

      The location to write error reports for records rejected asynchronously during magnetic store writes.

      • S3Configuration (dict) --

        Configuration of an S3 location to write error reports for records rejected, asynchronously, during magnetic store writes.

        • BucketName (string) --

          The bucket name of the customer S3 bucket.

        • ObjectKeyPrefix (string) --

          The object key preview for the customer S3 location.

        • EncryptionOption (string) --

          The encryption option for the customer S3 location. Options are S3 server-side encryption with an S3 managed key or Amazon Web Services managed key.

        • KmsKeyId (string) --

          The KMS key ID for the customer S3 location when encrypting with an Amazon Web Services managed key.

Return type

dict

Returns

Response Syntax

{
    'Table': {
        'Arn': 'string',
        'TableName': 'string',
        'DatabaseName': 'string',
        'TableStatus': 'ACTIVE'|'DELETING'|'RESTORING',
        'RetentionProperties': {
            'MemoryStoreRetentionPeriodInHours': 123,
            'MagneticStoreRetentionPeriodInDays': 123
        },
        'CreationTime': datetime(2015, 1, 1),
        'LastUpdatedTime': datetime(2015, 1, 1),
        'MagneticStoreWriteProperties': {
            'EnableMagneticStoreWrites': True|False,
            'MagneticStoreRejectedDataLocation': {
                'S3Configuration': {
                    'BucketName': 'string',
                    'ObjectKeyPrefix': 'string',
                    'EncryptionOption': 'SSE_S3'|'SSE_KMS',
                    'KmsKeyId': 'string'
                }
            }
        }
    }
}

Response Structure

  • (dict) --

    • Table (dict) --

      The newly created Timestream table.

      • Arn (string) --

        The Amazon Resource Name that uniquely identifies this table.

      • TableName (string) --

        The name of the Timestream table.

      • DatabaseName (string) --

        The name of the Timestream database that contains this table.

      • TableStatus (string) --

        The current state of the table:

        • DELETING - The table is being deleted.
        • ACTIVE - The table is ready for use.
      • RetentionProperties (dict) --

        The retention duration for the memory store and magnetic store.

        • MemoryStoreRetentionPeriodInHours (integer) --

          The duration for which data must be stored in the memory store.

        • MagneticStoreRetentionPeriodInDays (integer) --

          The duration for which data must be stored in the magnetic store.

      • CreationTime (datetime) --

        The time when the Timestream table was created.

      • LastUpdatedTime (datetime) --

        The time when the Timestream table was last updated.

      • MagneticStoreWriteProperties (dict) --

        Contains properties to set on the table when enabling magnetic store writes.

        • EnableMagneticStoreWrites (boolean) --

          A flag to enable magnetic store writes.

        • MagneticStoreRejectedDataLocation (dict) --

          The location to write error reports for records rejected asynchronously during magnetic store writes.

          • S3Configuration (dict) --

            Configuration of an S3 location to write error reports for records rejected, asynchronously, during magnetic store writes.

            • BucketName (string) --

              The bucket name of the customer S3 bucket.

            • ObjectKeyPrefix (string) --

              The object key preview for the customer S3 location.

            • EncryptionOption (string) --

              The encryption option for the customer S3 location. Options are S3 server-side encryption with an S3 managed key or Amazon Web Services managed key.

            • KmsKeyId (string) --

              The KMS key ID for the customer S3 location when encrypting with an Amazon Web Services managed key.

Exceptions

  • TimestreamWrite.Client.exceptions.ConflictException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.ServiceQuotaExceededException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
delete_database(**kwargs)

Deletes a given Timestream database. This is an irreversible operation. After a database is deleted, the time-series data from its tables cannot be recovered.

Note

All tables in the database must be deleted first, or a ValidationException error will be thrown.

Due to the nature of distributed retries, the operation can return either success or a ResourceNotFoundException. Clients should consider them equivalent.

See code sample for details.

See also: AWS API Documentation

Request Syntax

response = client.delete_database(
    DatabaseName='string'
)
Parameters
DatabaseName (string) --

[REQUIRED]

The name of the Timestream database to be deleted.

Returns
None

Exceptions

  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
delete_table(**kwargs)

Deletes a given Timestream table. This is an irreversible operation. After a Timestream database table is deleted, the time-series data stored in the table cannot be recovered.

Note

Due to the nature of distributed retries, the operation can return either success or a ResourceNotFoundException. Clients should consider them equivalent.

See code sample for details.

See also: AWS API Documentation

Request Syntax

response = client.delete_table(
    DatabaseName='string',
    TableName='string'
)
Parameters
  • DatabaseName (string) --

    [REQUIRED]

    The name of the database where the Timestream database is to be deleted.

  • TableName (string) --

    [REQUIRED]

    The name of the Timestream table to be deleted.

Returns

None

Exceptions

  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
describe_batch_load_task(**kwargs)

Returns information about the batch load task, including configurations, mappings, progress, and other details. Service quotas apply. See code sample for details.

See also: AWS API Documentation

Request Syntax

response = client.describe_batch_load_task(
    TaskId='string'
)
Parameters
TaskId (string) --

[REQUIRED]

The ID of the batch load task.

Return type
dict
Returns
Response Syntax
{
    'BatchLoadTaskDescription': {
        'TaskId': 'string',
        'ErrorMessage': 'string',
        'DataSourceConfiguration': {
            'DataSourceS3Configuration': {
                'BucketName': 'string',
                'ObjectKeyPrefix': 'string'
            },
            'CsvConfiguration': {
                'ColumnSeparator': 'string',
                'EscapeChar': 'string',
                'QuoteChar': 'string',
                'NullValue': 'string',
                'TrimWhiteSpace': True|False
            },
            'DataFormat': 'CSV'
        },
        'ProgressReport': {
            'RecordsProcessed': 123,
            'RecordsIngested': 123,
            'ParseFailures': 123,
            'RecordIngestionFailures': 123,
            'FileFailures': 123,
            'BytesMetered': 123
        },
        'ReportConfiguration': {
            'ReportS3Configuration': {
                'BucketName': 'string',
                'ObjectKeyPrefix': 'string',
                'EncryptionOption': 'SSE_S3'|'SSE_KMS',
                'KmsKeyId': 'string'
            }
        },
        'DataModelConfiguration': {
            'DataModel': {
                'TimeColumn': 'string',
                'TimeUnit': 'MILLISECONDS'|'SECONDS'|'MICROSECONDS'|'NANOSECONDS',
                'DimensionMappings': [
                    {
                        'SourceColumn': 'string',
                        'DestinationColumn': 'string'
                    },
                ],
                'MultiMeasureMappings': {
                    'TargetMultiMeasureName': 'string',
                    'MultiMeasureAttributeMappings': [
                        {
                            'SourceColumn': 'string',
                            'TargetMultiMeasureAttributeName': 'string',
                            'MeasureValueType': 'DOUBLE'|'BIGINT'|'BOOLEAN'|'VARCHAR'|'TIMESTAMP'
                        },
                    ]
                },
                'MixedMeasureMappings': [
                    {
                        'MeasureName': 'string',
                        'SourceColumn': 'string',
                        'TargetMeasureName': 'string',
                        'MeasureValueType': 'DOUBLE'|'BIGINT'|'VARCHAR'|'BOOLEAN'|'TIMESTAMP'|'MULTI',
                        'MultiMeasureAttributeMappings': [
                            {
                                'SourceColumn': 'string',
                                'TargetMultiMeasureAttributeName': 'string',
                                'MeasureValueType': 'DOUBLE'|'BIGINT'|'BOOLEAN'|'VARCHAR'|'TIMESTAMP'
                            },
                        ]
                    },
                ],
                'MeasureNameColumn': 'string'
            },
            'DataModelS3Configuration': {
                'BucketName': 'string',
                'ObjectKey': 'string'
            }
        },
        'TargetDatabaseName': 'string',
        'TargetTableName': 'string',
        'TaskStatus': 'CREATED'|'IN_PROGRESS'|'FAILED'|'SUCCEEDED'|'PROGRESS_STOPPED'|'PENDING_RESUME',
        'RecordVersion': 123,
        'CreationTime': datetime(2015, 1, 1),
        'LastUpdatedTime': datetime(2015, 1, 1),
        'ResumableUntil': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --
    • BatchLoadTaskDescription (dict) --

      Description of the batch load task.

      • TaskId (string) --

        The ID of the batch load task.

      • ErrorMessage (string) --
      • DataSourceConfiguration (dict) --

        Configuration details about the data source for a batch load task.

        • DataSourceS3Configuration (dict) --

          Configuration of an S3 location for a file which contains data to load.

          • BucketName (string) --

            The bucket name of the customer S3 bucket.

          • ObjectKeyPrefix (string) --
        • CsvConfiguration (dict) --

          A delimited data format where the column separator can be a comma and the record separator is a newline character.

          • ColumnSeparator (string) --

            Column separator can be one of comma (','), pipe ('|), semicolon (';'), tab('/t'), or blank space (' ').

          • EscapeChar (string) --

            Escape character can be one of

          • QuoteChar (string) --

            Can be single quote (') or double quote (").

          • NullValue (string) --

            Can be blank space (' ').

          • TrimWhiteSpace (boolean) --

            Specifies to trim leading and trailing white space.

        • DataFormat (string) --

          This is currently CSV.

      • ProgressReport (dict) --
        • RecordsProcessed (integer) --
        • RecordsIngested (integer) --
        • ParseFailures (integer) --
        • RecordIngestionFailures (integer) --
        • FileFailures (integer) --
        • BytesMetered (integer) --
      • ReportConfiguration (dict) --

        Report configuration for a batch load task. This contains details about where error reports are stored.

        • ReportS3Configuration (dict) --

          Configuration of an S3 location to write error reports and events for a batch load.

          • BucketName (string) --
          • ObjectKeyPrefix (string) --
          • EncryptionOption (string) --
          • KmsKeyId (string) --
      • DataModelConfiguration (dict) --

        Data model configuration for a batch load task. This contains details about where a data model for a batch load task is stored.

        • DataModel (dict) --
          • TimeColumn (string) --

            Source column to be mapped to time.

          • TimeUnit (string) --

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

          • DimensionMappings (list) --

            Source to target mappings for dimensions.

            • (dict) --
              • SourceColumn (string) --
              • DestinationColumn (string) --
          • MultiMeasureMappings (dict) --

            Source to target mappings for multi-measure records.

            • TargetMultiMeasureName (string) --
            • MultiMeasureAttributeMappings (list) --
              • (dict) --
                • SourceColumn (string) --
                • TargetMultiMeasureAttributeName (string) --
                • MeasureValueType (string) --
          • MixedMeasureMappings (list) --

            Source to target mappings for measures.

            • (dict) --
              • MeasureName (string) --
              • SourceColumn (string) --
              • TargetMeasureName (string) --
              • MeasureValueType (string) --
              • MultiMeasureAttributeMappings (list) --
                • (dict) --
                  • SourceColumn (string) --
                  • TargetMultiMeasureAttributeName (string) --
                  • MeasureValueType (string) --
          • MeasureNameColumn (string) --
        • DataModelS3Configuration (dict) --
          • BucketName (string) --
          • ObjectKey (string) --
      • TargetDatabaseName (string) --
      • TargetTableName (string) --
      • TaskStatus (string) --

        Status of the batch load task.

      • RecordVersion (integer) --
      • CreationTime (datetime) --

        The time when the Timestream batch load task was created.

      • LastUpdatedTime (datetime) --

        The time when the Timestream batch load task was last updated.

      • ResumableUntil (datetime) --

Exceptions

  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
describe_database(**kwargs)

Returns information about the database, including the database name, time that the database was created, and the total number of tables found within the database. Service quotas apply. See code sample for details.

See also: AWS API Documentation

Request Syntax

response = client.describe_database(
    DatabaseName='string'
)
Parameters
DatabaseName (string) --

[REQUIRED]

The name of the Timestream database.

Return type
dict
Returns
Response Syntax
{
    'Database': {
        'Arn': 'string',
        'DatabaseName': 'string',
        'TableCount': 123,
        'KmsKeyId': 'string',
        'CreationTime': datetime(2015, 1, 1),
        'LastUpdatedTime': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --
    • Database (dict) --

      The name of the Timestream table.

      • Arn (string) --

        The Amazon Resource Name that uniquely identifies this database.

      • DatabaseName (string) --

        The name of the Timestream database.

      • TableCount (integer) --

        The total number of tables found within a Timestream database.

      • KmsKeyId (string) --

        The identifier of the KMS key used to encrypt the data stored in the database.

      • CreationTime (datetime) --

        The time when the database was created, calculated from the Unix epoch time.

      • LastUpdatedTime (datetime) --

        The last time that this database was updated.

Exceptions

  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
describe_endpoints()

Returns a list of available endpoints to make Timestream API calls against. This API operation is available through both the Write and Query APIs.

Because the Timestream SDKs are designed to transparently work with the service’s architecture, including the management and mapping of the service endpoints, we don't recommend that you use this API operation unless :

For detailed information on how and when to use and implement DescribeEndpoints, see The Endpoint Discovery Pattern.

See also: AWS API Documentation

Request Syntax

response = client.describe_endpoints()
Return type
dict
Returns
Response Syntax
{
    'Endpoints': [
        {
            'Address': 'string',
            'CachePeriodInMinutes': 123
        },
    ]
}

Response Structure

  • (dict) --
    • Endpoints (list) --

      An Endpoints object is returned when a DescribeEndpoints request is made.

      • (dict) --

        Represents an available endpoint against which to make API calls against, as well as the TTL for that endpoint.

        • Address (string) --

          An endpoint address.

        • CachePeriodInMinutes (integer) --

          The TTL for the endpoint, in minutes.

Exceptions

  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.ThrottlingException
describe_table(**kwargs)

Returns information about the table, including the table name, database name, retention duration of the memory store and the magnetic store. Service quotas apply. See code sample for details.

See also: AWS API Documentation

Request Syntax

response = client.describe_table(
    DatabaseName='string',
    TableName='string'
)
Parameters
  • DatabaseName (string) --

    [REQUIRED]

    The name of the Timestream database.

  • TableName (string) --

    [REQUIRED]

    The name of the Timestream table.

Return type

dict

Returns

Response Syntax

{
    'Table': {
        'Arn': 'string',
        'TableName': 'string',
        'DatabaseName': 'string',
        'TableStatus': 'ACTIVE'|'DELETING'|'RESTORING',
        'RetentionProperties': {
            'MemoryStoreRetentionPeriodInHours': 123,
            'MagneticStoreRetentionPeriodInDays': 123
        },
        'CreationTime': datetime(2015, 1, 1),
        'LastUpdatedTime': datetime(2015, 1, 1),
        'MagneticStoreWriteProperties': {
            'EnableMagneticStoreWrites': True|False,
            'MagneticStoreRejectedDataLocation': {
                'S3Configuration': {
                    'BucketName': 'string',
                    'ObjectKeyPrefix': 'string',
                    'EncryptionOption': 'SSE_S3'|'SSE_KMS',
                    'KmsKeyId': 'string'
                }
            }
        }
    }
}

Response Structure

  • (dict) --

    • Table (dict) --

      The Timestream table.

      • Arn (string) --

        The Amazon Resource Name that uniquely identifies this table.

      • TableName (string) --

        The name of the Timestream table.

      • DatabaseName (string) --

        The name of the Timestream database that contains this table.

      • TableStatus (string) --

        The current state of the table:

        • DELETING - The table is being deleted.
        • ACTIVE - The table is ready for use.
      • RetentionProperties (dict) --

        The retention duration for the memory store and magnetic store.

        • MemoryStoreRetentionPeriodInHours (integer) --

          The duration for which data must be stored in the memory store.

        • MagneticStoreRetentionPeriodInDays (integer) --

          The duration for which data must be stored in the magnetic store.

      • CreationTime (datetime) --

        The time when the Timestream table was created.

      • LastUpdatedTime (datetime) --

        The time when the Timestream table was last updated.

      • MagneticStoreWriteProperties (dict) --

        Contains properties to set on the table when enabling magnetic store writes.

        • EnableMagneticStoreWrites (boolean) --

          A flag to enable magnetic store writes.

        • MagneticStoreRejectedDataLocation (dict) --

          The location to write error reports for records rejected asynchronously during magnetic store writes.

          • S3Configuration (dict) --

            Configuration of an S3 location to write error reports for records rejected, asynchronously, during magnetic store writes.

            • BucketName (string) --

              The bucket name of the customer S3 bucket.

            • ObjectKeyPrefix (string) --

              The object key preview for the customer S3 location.

            • EncryptionOption (string) --

              The encryption option for the customer S3 location. Options are S3 server-side encryption with an S3 managed key or Amazon Web Services managed key.

            • KmsKeyId (string) --

              The KMS key ID for the customer S3 location when encrypting with an Amazon Web Services managed key.

Exceptions

  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
list_batch_load_tasks(**kwargs)

Provides a list of batch load tasks, along with the name, status, when the task is resumable until, and other details. See code sample for details.

See also: AWS API Documentation

Request Syntax

response = client.list_batch_load_tasks(
    NextToken='string',
    MaxResults=123,
    TaskStatus='CREATED'|'IN_PROGRESS'|'FAILED'|'SUCCEEDED'|'PROGRESS_STOPPED'|'PENDING_RESUME'
)
Parameters
  • NextToken (string) -- A token to specify where to start paginating. This is the NextToken from a previously truncated response.
  • MaxResults (integer) -- The total number of items to return in the output. If the total number of items available is more than the value specified, a NextToken is provided in the output. To resume pagination, provide the NextToken value as argument of a subsequent API invocation.
  • TaskStatus (string) -- Status of the batch load task.
Return type

dict

Returns

Response Syntax

{
    'NextToken': 'string',
    'BatchLoadTasks': [
        {
            'TaskId': 'string',
            'TaskStatus': 'CREATED'|'IN_PROGRESS'|'FAILED'|'SUCCEEDED'|'PROGRESS_STOPPED'|'PENDING_RESUME',
            'DatabaseName': 'string',
            'TableName': 'string',
            'CreationTime': datetime(2015, 1, 1),
            'LastUpdatedTime': datetime(2015, 1, 1),
            'ResumableUntil': datetime(2015, 1, 1)
        },
    ]
}

Response Structure

  • (dict) --

    • NextToken (string) --

      A token to specify where to start paginating. Provide the next ListBatchLoadTasksRequest.

    • BatchLoadTasks (list) --

      A list of batch load task details.

      • (dict) --

        Details about a batch load task.

        • TaskId (string) --

          The ID of the batch load task.

        • TaskStatus (string) --

          Status of the batch load task.

        • DatabaseName (string) --

          Database name for the database into which a batch load task loads data.

        • TableName (string) --

          Table name for the table into which a batch load task loads data.

        • CreationTime (datetime) --

          The time when the Timestream batch load task was created.

        • LastUpdatedTime (datetime) --

          The time when the Timestream batch load task was last updated.

        • ResumableUntil (datetime) --

Exceptions

  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
list_databases(**kwargs)

Returns a list of your Timestream databases. Service quotas apply. See code sample for details.

See also: AWS API Documentation

Request Syntax

response = client.list_databases(
    NextToken='string',
    MaxResults=123
)
Parameters
  • NextToken (string) -- The pagination token. To resume pagination, provide the NextToken value as argument of a subsequent API invocation.
  • MaxResults (integer) -- The total number of items to return in the output. If the total number of items available is more than the value specified, a NextToken is provided in the output. To resume pagination, provide the NextToken value as argument of a subsequent API invocation.
Return type

dict

Returns

Response Syntax

{
    'Databases': [
        {
            'Arn': 'string',
            'DatabaseName': 'string',
            'TableCount': 123,
            'KmsKeyId': 'string',
            'CreationTime': datetime(2015, 1, 1),
            'LastUpdatedTime': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Databases (list) --

      A list of database names.

      • (dict) --

        A top-level container for a table. Databases and tables are the fundamental management concepts in Amazon Timestream. All tables in a database are encrypted with the same KMS key.

        • Arn (string) --

          The Amazon Resource Name that uniquely identifies this database.

        • DatabaseName (string) --

          The name of the Timestream database.

        • TableCount (integer) --

          The total number of tables found within a Timestream database.

        • KmsKeyId (string) --

          The identifier of the KMS key used to encrypt the data stored in the database.

        • CreationTime (datetime) --

          The time when the database was created, calculated from the Unix epoch time.

        • LastUpdatedTime (datetime) --

          The last time that this database was updated.

    • NextToken (string) --

      The pagination token. This parameter is returned when the response is truncated.

Exceptions

  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
list_tables(**kwargs)

Provides a list of tables, along with the name, status, and retention properties of each table. See code sample for details.

See also: AWS API Documentation

Request Syntax

response = client.list_tables(
    DatabaseName='string',
    NextToken='string',
    MaxResults=123
)
Parameters
  • DatabaseName (string) -- The name of the Timestream database.
  • NextToken (string) -- The pagination token. To resume pagination, provide the NextToken value as argument of a subsequent API invocation.
  • MaxResults (integer) -- The total number of items to return in the output. If the total number of items available is more than the value specified, a NextToken is provided in the output. To resume pagination, provide the NextToken value as argument of a subsequent API invocation.
Return type

dict

Returns

Response Syntax

{
    'Tables': [
        {
            'Arn': 'string',
            'TableName': 'string',
            'DatabaseName': 'string',
            'TableStatus': 'ACTIVE'|'DELETING'|'RESTORING',
            'RetentionProperties': {
                'MemoryStoreRetentionPeriodInHours': 123,
                'MagneticStoreRetentionPeriodInDays': 123
            },
            'CreationTime': datetime(2015, 1, 1),
            'LastUpdatedTime': datetime(2015, 1, 1),
            'MagneticStoreWriteProperties': {
                'EnableMagneticStoreWrites': True|False,
                'MagneticStoreRejectedDataLocation': {
                    'S3Configuration': {
                        'BucketName': 'string',
                        'ObjectKeyPrefix': 'string',
                        'EncryptionOption': 'SSE_S3'|'SSE_KMS',
                        'KmsKeyId': 'string'
                    }
                }
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Tables (list) --

      A list of tables.

      • (dict) --

        Represents a database table in Timestream. Tables contain one or more related time series. You can modify the retention duration of the memory store and the magnetic store for a table.

        • Arn (string) --

          The Amazon Resource Name that uniquely identifies this table.

        • TableName (string) --

          The name of the Timestream table.

        • DatabaseName (string) --

          The name of the Timestream database that contains this table.

        • TableStatus (string) --

          The current state of the table:

          • DELETING - The table is being deleted.
          • ACTIVE - The table is ready for use.
        • RetentionProperties (dict) --

          The retention duration for the memory store and magnetic store.

          • MemoryStoreRetentionPeriodInHours (integer) --

            The duration for which data must be stored in the memory store.

          • MagneticStoreRetentionPeriodInDays (integer) --

            The duration for which data must be stored in the magnetic store.

        • CreationTime (datetime) --

          The time when the Timestream table was created.

        • LastUpdatedTime (datetime) --

          The time when the Timestream table was last updated.

        • MagneticStoreWriteProperties (dict) --

          Contains properties to set on the table when enabling magnetic store writes.

          • EnableMagneticStoreWrites (boolean) --

            A flag to enable magnetic store writes.

          • MagneticStoreRejectedDataLocation (dict) --

            The location to write error reports for records rejected asynchronously during magnetic store writes.

            • S3Configuration (dict) --

              Configuration of an S3 location to write error reports for records rejected, asynchronously, during magnetic store writes.

              • BucketName (string) --

                The bucket name of the customer S3 bucket.

              • ObjectKeyPrefix (string) --

                The object key preview for the customer S3 location.

              • EncryptionOption (string) --

                The encryption option for the customer S3 location. Options are S3 server-side encryption with an S3 managed key or Amazon Web Services managed key.

              • KmsKeyId (string) --

                The KMS key ID for the customer S3 location when encrypting with an Amazon Web Services managed key.

    • NextToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previously truncated response.

Exceptions

  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
list_tags_for_resource(**kwargs)

Lists all tags on a Timestream resource.

See also: AWS API Documentation

Request Syntax

response = client.list_tags_for_resource(
    ResourceARN='string'
)
Parameters
ResourceARN (string) --

[REQUIRED]

The Timestream resource with tags to be listed. This value is an Amazon Resource Name (ARN).

Return type
dict
Returns
Response Syntax
{
    'Tags': [
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
}

Response Structure

  • (dict) --
    • Tags (list) --

      The tags currently associated with the Timestream resource.

      • (dict) --

        A tag is a label that you assign to a Timestream database and/or table. Each tag consists of a key and an optional value, both of which you define. With tags, you can categorize databases and/or tables, for example, by purpose, owner, or environment.

        • Key (string) --

          The key of the tag. Tag keys are case sensitive.

        • Value (string) --

          The value of the tag. Tag values are case-sensitive and can be null.

Exceptions

  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
resume_batch_load_task(**kwargs)

See also: AWS API Documentation

Request Syntax

response = client.resume_batch_load_task(
    TaskId='string'
)
Parameters
TaskId (string) --

[REQUIRED]

The ID of the batch load task to resume.

Return type
dict
Returns
Response Syntax
{}

Response Structure

  • (dict) --

Exceptions

  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
tag_resource(**kwargs)

Associates a set of tags with a Timestream resource. You can then activate these user-defined tags so that they appear on the Billing and Cost Management console for cost allocation tracking.

See also: AWS API Documentation

Request Syntax

response = client.tag_resource(
    ResourceARN='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
Parameters
  • ResourceARN (string) --

    [REQUIRED]

    Identifies the Timestream resource to which tags should be added. This value is an Amazon Resource Name (ARN).

  • Tags (list) --

    [REQUIRED]

    The tags to be assigned to the Timestream resource.

    • (dict) --

      A tag is a label that you assign to a Timestream database and/or table. Each tag consists of a key and an optional value, both of which you define. With tags, you can categorize databases and/or tables, for example, by purpose, owner, or environment.

      • Key (string) -- [REQUIRED]

        The key of the tag. Tag keys are case sensitive.

      • Value (string) -- [REQUIRED]

        The value of the tag. Tag values are case-sensitive and can be null.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.ServiceQuotaExceededException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
untag_resource(**kwargs)

Removes the association of tags from a Timestream resource.

See also: AWS API Documentation

Request Syntax

response = client.untag_resource(
    ResourceARN='string',
    TagKeys=[
        'string',
    ]
)
Parameters
  • ResourceARN (string) --

    [REQUIRED]

    The Timestream resource that the tags will be removed from. This value is an Amazon Resource Name (ARN).

  • TagKeys (list) --

    [REQUIRED]

    A list of tags keys. Existing tags of the resource whose keys are members of this list will be removed from the Timestream resource.

    • (string) --
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

Exceptions

  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.ServiceQuotaExceededException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
update_database(**kwargs)

Modifies the KMS key for an existing database. While updating the database, you must specify the database name and the identifier of the new KMS key to be used ( KmsKeyId ). If there are any concurrent UpdateDatabase requests, first writer wins.

See code sample for details.

See also: AWS API Documentation

Request Syntax

response = client.update_database(
    DatabaseName='string',
    KmsKeyId='string'
)
Parameters
  • DatabaseName (string) --

    [REQUIRED]

    The name of the database.

  • KmsKeyId (string) --

    [REQUIRED]

    The identifier of the new KMS key ( KmsKeyId ) to be used to encrypt the data stored in the database. If the KmsKeyId currently registered with the database is the same as the KmsKeyId in the request, there will not be any update.

    You can specify the KmsKeyId using any of the following:

    • Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    • Key ARN: arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    • Alias name: alias/ExampleAlias
    • Alias ARN: arn:aws:kms:us-east-1:111122223333:alias/ExampleAlias
Return type

dict

Returns

Response Syntax

{
    'Database': {
        'Arn': 'string',
        'DatabaseName': 'string',
        'TableCount': 123,
        'KmsKeyId': 'string',
        'CreationTime': datetime(2015, 1, 1),
        'LastUpdatedTime': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • Database (dict) --

      A top-level container for a table. Databases and tables are the fundamental management concepts in Amazon Timestream. All tables in a database are encrypted with the same KMS key.

      • Arn (string) --

        The Amazon Resource Name that uniquely identifies this database.

      • DatabaseName (string) --

        The name of the Timestream database.

      • TableCount (integer) --

        The total number of tables found within a Timestream database.

      • KmsKeyId (string) --

        The identifier of the KMS key used to encrypt the data stored in the database.

      • CreationTime (datetime) --

        The time when the database was created, calculated from the Unix epoch time.

      • LastUpdatedTime (datetime) --

        The last time that this database was updated.

Exceptions

  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.ServiceQuotaExceededException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
update_table(**kwargs)

Modifies the retention duration of the memory store and magnetic store for your Timestream table. Note that the change in retention duration takes effect immediately. For example, if the retention period of the memory store was initially set to 2 hours and then changed to 24 hours, the memory store will be capable of holding 24 hours of data, but will be populated with 24 hours of data 22 hours after this change was made. Timestream does not retrieve data from the magnetic store to populate the memory store.

See code sample for details.

See also: AWS API Documentation

Request Syntax

response = client.update_table(
    DatabaseName='string',
    TableName='string',
    RetentionProperties={
        'MemoryStoreRetentionPeriodInHours': 123,
        'MagneticStoreRetentionPeriodInDays': 123
    },
    MagneticStoreWriteProperties={
        'EnableMagneticStoreWrites': True|False,
        'MagneticStoreRejectedDataLocation': {
            'S3Configuration': {
                'BucketName': 'string',
                'ObjectKeyPrefix': 'string',
                'EncryptionOption': 'SSE_S3'|'SSE_KMS',
                'KmsKeyId': 'string'
            }
        }
    }
)
Parameters
  • DatabaseName (string) --

    [REQUIRED]

    The name of the Timestream database.

  • TableName (string) --

    [REQUIRED]

    The name of the Timestream table.

  • RetentionProperties (dict) --

    The retention duration of the memory store and the magnetic store.

    • MemoryStoreRetentionPeriodInHours (integer) -- [REQUIRED]

      The duration for which data must be stored in the memory store.

    • MagneticStoreRetentionPeriodInDays (integer) -- [REQUIRED]

      The duration for which data must be stored in the magnetic store.

  • MagneticStoreWriteProperties (dict) --

    Contains properties to set on the table when enabling magnetic store writes.

    • EnableMagneticStoreWrites (boolean) -- [REQUIRED]

      A flag to enable magnetic store writes.

    • MagneticStoreRejectedDataLocation (dict) --

      The location to write error reports for records rejected asynchronously during magnetic store writes.

      • S3Configuration (dict) --

        Configuration of an S3 location to write error reports for records rejected, asynchronously, during magnetic store writes.

        • BucketName (string) --

          The bucket name of the customer S3 bucket.

        • ObjectKeyPrefix (string) --

          The object key preview for the customer S3 location.

        • EncryptionOption (string) --

          The encryption option for the customer S3 location. Options are S3 server-side encryption with an S3 managed key or Amazon Web Services managed key.

        • KmsKeyId (string) --

          The KMS key ID for the customer S3 location when encrypting with an Amazon Web Services managed key.

Return type

dict

Returns

Response Syntax

{
    'Table': {
        'Arn': 'string',
        'TableName': 'string',
        'DatabaseName': 'string',
        'TableStatus': 'ACTIVE'|'DELETING'|'RESTORING',
        'RetentionProperties': {
            'MemoryStoreRetentionPeriodInHours': 123,
            'MagneticStoreRetentionPeriodInDays': 123
        },
        'CreationTime': datetime(2015, 1, 1),
        'LastUpdatedTime': datetime(2015, 1, 1),
        'MagneticStoreWriteProperties': {
            'EnableMagneticStoreWrites': True|False,
            'MagneticStoreRejectedDataLocation': {
                'S3Configuration': {
                    'BucketName': 'string',
                    'ObjectKeyPrefix': 'string',
                    'EncryptionOption': 'SSE_S3'|'SSE_KMS',
                    'KmsKeyId': 'string'
                }
            }
        }
    }
}

Response Structure

  • (dict) --

    • Table (dict) --

      The updated Timestream table.

      • Arn (string) --

        The Amazon Resource Name that uniquely identifies this table.

      • TableName (string) --

        The name of the Timestream table.

      • DatabaseName (string) --

        The name of the Timestream database that contains this table.

      • TableStatus (string) --

        The current state of the table:

        • DELETING - The table is being deleted.
        • ACTIVE - The table is ready for use.
      • RetentionProperties (dict) --

        The retention duration for the memory store and magnetic store.

        • MemoryStoreRetentionPeriodInHours (integer) --

          The duration for which data must be stored in the memory store.

        • MagneticStoreRetentionPeriodInDays (integer) --

          The duration for which data must be stored in the magnetic store.

      • CreationTime (datetime) --

        The time when the Timestream table was created.

      • LastUpdatedTime (datetime) --

        The time when the Timestream table was last updated.

      • MagneticStoreWriteProperties (dict) --

        Contains properties to set on the table when enabling magnetic store writes.

        • EnableMagneticStoreWrites (boolean) --

          A flag to enable magnetic store writes.

        • MagneticStoreRejectedDataLocation (dict) --

          The location to write error reports for records rejected asynchronously during magnetic store writes.

          • S3Configuration (dict) --

            Configuration of an S3 location to write error reports for records rejected, asynchronously, during magnetic store writes.

            • BucketName (string) --

              The bucket name of the customer S3 bucket.

            • ObjectKeyPrefix (string) --

              The object key preview for the customer S3 location.

            • EncryptionOption (string) --

              The encryption option for the customer S3 location. Options are S3 server-side encryption with an S3 managed key or Amazon Web Services managed key.

            • KmsKeyId (string) --

              The KMS key ID for the customer S3 location when encrypting with an Amazon Web Services managed key.

Exceptions

  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException
write_records(**kwargs)

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 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 supports 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.

See code sample for details.

Upserts

You can use the Version parameter in a WriteRecords request to update data points. Timestream tracks a version number with each record. Version defaults to 1 when it's not specified for the record in the request. Timestream updates an existing record’s measure value along with its Version when it receives a write request with a higher Version number for that record. When it receives an update request where the measure value is the same as that of the existing record, Timestream still updates Version , if it is greater than the existing value of Version . You can update a data point as many times as desired, as long as the value of Version continuously increases.

For example, suppose you write a new record without indicating Version in the request. Timestream stores this record, and set Version to 1 . Now, suppose you try to update this record with a WriteRecords request of the same record with a different measure value but, like before, do not provide Version . In this case, Timestream will reject this update with a RejectedRecordsException since the updated record’s version is not greater than the existing value of Version.

However, if you were to resend the update request with Version set to 2 , Timestream would then succeed in updating the record’s value, and the Version would be set to 2 . Next, suppose you sent a WriteRecords request with this same record and an identical measure value, but with Version set to 3 . In this case, Timestream would only update Version to 3 . Any further updates would need to send a version number greater than 3 , or the update requests would receive a RejectedRecordsException .

See also: AWS API Documentation

Request Syntax

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

    [REQUIRED]

    The name of the Timestream database.

  • TableName (string) --

    [REQUIRED]

    The name of the Timestream table.

  • CommonAttributes (dict) --

    A record that contains the common measure, dimension, time, and version attributes shared across all the records in the request. The measure and dimension attributes specified will be merged with the measure and dimension attributes in the records object when the data is written into Timestream. Dimensions may not overlap, or a ValidationException will be thrown. In other words, a record must contain dimensions with unique names.

    • Dimensions (list) --

      Contains the list of dimensions for time-series data points.

      • (dict) --

        Represents the metadata 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 metadata 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. Default type is DOUBLE .

    • 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. Default is MILLISECONDS .

    • 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 1 .

      Note

      Version must be 1 or greater, or you will receive a ValidationException error.

    • MeasureValues (list) --

      Contains the list of MeasureValue for time-series data points.

      This is only allowed for type MULTI . For scalar values, use MeasureValue attribute of the record directly.

      • (dict) --

        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 has both name and value.

        MeasureValue is only allowed for type MULTI . Using MULTI type, you can pass multiple data attributes associated with the same time series in a single record

        • Name (string) -- [REQUIRED]

          The name of the MeasureValue.

          For constraints on MeasureValue names, see Naming Constraints in the Amazon Timestream Developer Guide.

        • Value (string) -- [REQUIRED]

          The value for the MeasureValue.

        • Type (string) -- [REQUIRED]

          Contains the data type of the MeasureValue for the time-series data point.

  • Records (list) --

    [REQUIRED]

    An array of records that contain the unique measure, dimension, time, and version attributes for each time-series data point.

    • (dict) --

      Represents a time-series data point being written into Timestream. Each record contains an array of dimensions. Dimensions represent the metadata 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). Additionally, a record contains the measure value and the value type, which is the data type of the measure value. Also, the record contains the timestamp of when the measure was collected and the timestamp unit, which represents the granularity of the timestamp.

      Records have a Version field, which is a 64-bit long that you can use for updating data points. Writes of a duplicate record with the same dimension, timestamp, and measure name but different measure value will only succeed if the Version attribute of the record in the write request is higher than that of the existing record. Timestream defaults to a Version of 1 for records without the Version field.

      • Dimensions (list) --

        Contains the list of dimensions for time-series data points.

        • (dict) --

          Represents the metadata 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 metadata 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. Default type is DOUBLE .

      • 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. Default is MILLISECONDS .

      • 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 1 .

        Note

        Version must be 1 or greater, or you will receive a ValidationException error.

      • MeasureValues (list) --

        Contains the list of MeasureValue for time-series data points.

        This is only allowed for type MULTI . For scalar values, use MeasureValue attribute of the record directly.

        • (dict) --

          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 has both name and value.

          MeasureValue is only allowed for type MULTI . Using MULTI type, you can pass multiple data attributes associated with the same time series in a single record

          • Name (string) -- [REQUIRED]

            The name of the MeasureValue.

            For constraints on MeasureValue names, see Naming Constraints in the Amazon Timestream Developer Guide.

          • Value (string) -- [REQUIRED]

            The value for the MeasureValue.

          • Type (string) -- [REQUIRED]

            Contains the data type of the MeasureValue for the time-series data point.

Return type

dict

Returns

Response Syntax

{
    'RecordsIngested': {
        'Total': 123,
        'MemoryStore': 123,
        'MagneticStore': 123
    }
}

Response Structure

  • (dict) --

    • RecordsIngested (dict) --

      Information on the records ingested by this request.

      • Total (integer) --

        Total count of successfully ingested records.

      • MemoryStore (integer) --

        Count of records ingested into the memory store.

      • MagneticStore (integer) --

        Count of records ingested into the magnetic store.

Exceptions

  • TimestreamWrite.Client.exceptions.InternalServerException
  • TimestreamWrite.Client.exceptions.ThrottlingException
  • TimestreamWrite.Client.exceptions.ValidationException
  • TimestreamWrite.Client.exceptions.ResourceNotFoundException
  • TimestreamWrite.Client.exceptions.AccessDeniedException
  • TimestreamWrite.Client.exceptions.RejectedRecordsException
  • TimestreamWrite.Client.exceptions.InvalidEndpointException

Paginators

The available paginators are: