2023/06/08 - Amazon Timestream Write - 4 updated api methods
Changes This release adds the capability for customers to define how their data should be partitioned, optimizing for certain access patterns. This definition will take place as a part of the table creation.
{'Schema': {'CompositePartitionKey': [{'EnforcementInRecord': 'REQUIRED | ' 'OPTIONAL', 'Name': 'string', 'Type': 'DIMENSION | MEASURE'}]}}Response
{'Table': {'Schema': {'CompositePartitionKey': [{'EnforcementInRecord': 'REQUIRED ' '| ' 'OPTIONAL', 'Name': 'string', 'Type': 'DIMENSION | ' 'MEASURE'}]}}}
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
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' } } }, Schema={ 'CompositePartitionKey': [ { 'Type': 'DIMENSION'|'MEASURE', 'Name': 'string', 'EnforcementInRecord': 'REQUIRED'|'OPTIONAL' }, ] } )
string
[REQUIRED]
The name of the Timestream database.
string
[REQUIRED]
The name of the Timestream table.
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.
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.
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.
dict
The schema of the table.
CompositePartitionKey (list) --
A non-empty list of partition keys defining the attributes used to partition the table data. The order of the list determines the partition hierarchy. The name and type of each partition key as well as the partition key order cannot be changed after the table is created. However, the enforcement level of each partition key can be changed.
(dict) --
An attribute used in partitioning data in a table. A dimension key partitions data using the values of the dimension specified by the dimension-name as partition key, while a measure key partitions data using measure names (values of the 'measure_name' column).
Type (string) -- [REQUIRED]
The type of the partition key. Options are DIMENSION (dimension key) and MEASURE (measure key).
Name (string) --
The name of the attribute used for a dimension key.
EnforcementInRecord (string) --
The level of enforcement for the specification of a dimension key in ingested records. Options are REQUIRED (dimension key must be specified) and OPTIONAL (dimension key does not have to be specified).
dict
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' } } }, 'Schema': { 'CompositePartitionKey': [ { 'Type': 'DIMENSION'|'MEASURE', 'Name': 'string', 'EnforcementInRecord': 'REQUIRED'|'OPTIONAL' }, ] } } }
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.
Schema (dict) --
The schema of the table.
CompositePartitionKey (list) --
A non-empty list of partition keys defining the attributes used to partition the table data. The order of the list determines the partition hierarchy. The name and type of each partition key as well as the partition key order cannot be changed after the table is created. However, the enforcement level of each partition key can be changed.
(dict) --
An attribute used in partitioning data in a table. A dimension key partitions data using the values of the dimension specified by the dimension-name as partition key, while a measure key partitions data using measure names (values of the 'measure_name' column).
Type (string) --
The type of the partition key. Options are DIMENSION (dimension key) and MEASURE (measure key).
Name (string) --
The name of the attribute used for a dimension key.
EnforcementInRecord (string) --
The level of enforcement for the specification of a dimension key in ingested records. Options are REQUIRED (dimension key must be specified) and OPTIONAL (dimension key does not have to be specified).
{'Table': {'Schema': {'CompositePartitionKey': [{'EnforcementInRecord': 'REQUIRED ' '| ' 'OPTIONAL', 'Name': 'string', 'Type': 'DIMENSION | ' 'MEASURE'}]}}}
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
client.describe_table( DatabaseName='string', TableName='string' )
string
[REQUIRED]
The name of the Timestream database.
string
[REQUIRED]
The name of the Timestream table.
dict
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' } } }, 'Schema': { 'CompositePartitionKey': [ { 'Type': 'DIMENSION'|'MEASURE', 'Name': 'string', 'EnforcementInRecord': 'REQUIRED'|'OPTIONAL' }, ] } } }
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.
Schema (dict) --
The schema of the table.
CompositePartitionKey (list) --
A non-empty list of partition keys defining the attributes used to partition the table data. The order of the list determines the partition hierarchy. The name and type of each partition key as well as the partition key order cannot be changed after the table is created. However, the enforcement level of each partition key can be changed.
(dict) --
An attribute used in partitioning data in a table. A dimension key partitions data using the values of the dimension specified by the dimension-name as partition key, while a measure key partitions data using measure names (values of the 'measure_name' column).
Type (string) --
The type of the partition key. Options are DIMENSION (dimension key) and MEASURE (measure key).
Name (string) --
The name of the attribute used for a dimension key.
EnforcementInRecord (string) --
The level of enforcement for the specification of a dimension key in ingested records. Options are REQUIRED (dimension key must be specified) and OPTIONAL (dimension key does not have to be specified).
{'Tables': {'Schema': {'CompositePartitionKey': [{'EnforcementInRecord': 'REQUIRED ' '| ' 'OPTIONAL', 'Name': 'string', 'Type': 'DIMENSION | ' 'MEASURE'}]}}}
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
client.list_tables( DatabaseName='string', NextToken='string', MaxResults=123 )
string
The name of the Timestream database.
string
The pagination token. To resume pagination, provide the NextToken value as argument of a subsequent API invocation.
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.
dict
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' } } }, 'Schema': { 'CompositePartitionKey': [ { 'Type': 'DIMENSION'|'MEASURE', 'Name': 'string', 'EnforcementInRecord': 'REQUIRED'|'OPTIONAL' }, ] } }, ], '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.
Schema (dict) --
The schema of the table.
CompositePartitionKey (list) --
A non-empty list of partition keys defining the attributes used to partition the table data. The order of the list determines the partition hierarchy. The name and type of each partition key as well as the partition key order cannot be changed after the table is created. However, the enforcement level of each partition key can be changed.
(dict) --
An attribute used in partitioning data in a table. A dimension key partitions data using the values of the dimension specified by the dimension-name as partition key, while a measure key partitions data using measure names (values of the 'measure_name' column).
Type (string) --
The type of the partition key. Options are DIMENSION (dimension key) and MEASURE (measure key).
Name (string) --
The name of the attribute used for a dimension key.
EnforcementInRecord (string) --
The level of enforcement for the specification of a dimension key in ingested records. Options are REQUIRED (dimension key must be specified) and OPTIONAL (dimension key does not have to be specified).
NextToken (string) --
A token to specify where to start paginating. This is the NextToken from a previously truncated response.
{'Schema': {'CompositePartitionKey': [{'EnforcementInRecord': 'REQUIRED | ' 'OPTIONAL', 'Name': 'string', 'Type': 'DIMENSION | MEASURE'}]}}Response
{'Table': {'Schema': {'CompositePartitionKey': [{'EnforcementInRecord': 'REQUIRED ' '| ' 'OPTIONAL', 'Name': 'string', 'Type': 'DIMENSION | ' 'MEASURE'}]}}}
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
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' } } }, Schema={ 'CompositePartitionKey': [ { 'Type': 'DIMENSION'|'MEASURE', 'Name': 'string', 'EnforcementInRecord': 'REQUIRED'|'OPTIONAL' }, ] } )
string
[REQUIRED]
The name of the Timestream database.
string
[REQUIRED]
The name of the Timestream table.
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.
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.
dict
The schema of the table.
CompositePartitionKey (list) --
A non-empty list of partition keys defining the attributes used to partition the table data. The order of the list determines the partition hierarchy. The name and type of each partition key as well as the partition key order cannot be changed after the table is created. However, the enforcement level of each partition key can be changed.
(dict) --
An attribute used in partitioning data in a table. A dimension key partitions data using the values of the dimension specified by the dimension-name as partition key, while a measure key partitions data using measure names (values of the 'measure_name' column).
Type (string) -- [REQUIRED]
The type of the partition key. Options are DIMENSION (dimension key) and MEASURE (measure key).
Name (string) --
The name of the attribute used for a dimension key.
EnforcementInRecord (string) --
The level of enforcement for the specification of a dimension key in ingested records. Options are REQUIRED (dimension key must be specified) and OPTIONAL (dimension key does not have to be specified).
dict
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' } } }, 'Schema': { 'CompositePartitionKey': [ { 'Type': 'DIMENSION'|'MEASURE', 'Name': 'string', 'EnforcementInRecord': 'REQUIRED'|'OPTIONAL' }, ] } } }
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.
Schema (dict) --
The schema of the table.
CompositePartitionKey (list) --
A non-empty list of partition keys defining the attributes used to partition the table data. The order of the list determines the partition hierarchy. The name and type of each partition key as well as the partition key order cannot be changed after the table is created. However, the enforcement level of each partition key can be changed.
(dict) --
An attribute used in partitioning data in a table. A dimension key partitions data using the values of the dimension specified by the dimension-name as partition key, while a measure key partitions data using measure names (values of the 'measure_name' column).
Type (string) --
The type of the partition key. Options are DIMENSION (dimension key) and MEASURE (measure key).
Name (string) --
The name of the attribute used for a dimension key.
EnforcementInRecord (string) --
The level of enforcement for the specification of a dimension key in ingested records. Options are REQUIRED (dimension key must be specified) and OPTIONAL (dimension key does not have to be specified).