Skip to main content

tables

Creates, updates, deletes, gets or lists a tables resource.

Overview

Nametables
TypeResource
Idaws.timestream_write.tables

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
arnstringThe Amazon Resource Name that uniquely identifies this table.
creation_timestring (date-time)The time when the Timestream table was created.
database_namestringThe name of the Timestream database that contains this table.
last_updated_timestring (date-time)The time when the Timestream table was last updated.
magnetic_store_write_propertiesobjectContains properties to set on the table when enabling magnetic store writes.
retention_propertiesobjectThe retention duration for the memory store and magnetic store.
schemaobjectThe schema of the table.
table_namestringThe name of the Timestream table.
table_statusstringThe current state of the table: DELETING - The table is being deleted. ACTIVE - The table is ready for use. (ACTIVE, DELETING, RESTORING)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_tableselectregionReturns 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.
list_tablesselectregionProvides a list of tables, along with the name, status, and retention properties of each table. See code sample for details.
create_tableinsertregion, DatabaseName, TableNameAdds 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.
update_tableupdateregion, DatabaseName, TableNameModifies 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.
delete_tabledeleteregionDeletes 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. 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.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

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.

SELECT
arn,
creation_time,
database_name,
last_updated_time,
magnetic_store_write_properties,
retention_properties,
schema,
table_name,
table_status
FROM aws.timestream_write.tables
WHERE region = '{{ region }}' -- required
;

INSERT examples

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.

INSERT INTO aws.timestream_write.tables (
DatabaseName,
TableName,
RetentionProperties,
Tags,
MagneticStoreWriteProperties,
Schema,
region
)
SELECT
'{{ DatabaseName }}' /* required */,
'{{ TableName }}' /* required */,
'{{ RetentionProperties }}',
'{{ Tags }}',
'{{ MagneticStoreWriteProperties }}',
'{{ Schema }}',
'{{ region }}'
RETURNING
table
;

UPDATE examples

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.

UPDATE aws.timestream_write.tables
SET
DatabaseName = '{{ DatabaseName }}',
TableName = '{{ TableName }}',
RetentionProperties = '{{ RetentionProperties }}',
MagneticStoreWriteProperties = '{{ MagneticStoreWriteProperties }}',
Schema = '{{ Schema }}'
WHERE
region = '{{ region }}' --required
AND DatabaseName = '{{ DatabaseName }}' --required
AND TableName = '{{ TableName }}' --required
RETURNING
table;

DELETE examples

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

DELETE FROM aws.timestream_write.tables
WHERE region = '{{ region }}' --required
;