tables
Creates, updates, deletes, gets or lists a tables resource.
Overview
| Name | tables |
| Type | Resource |
| Id | aws.keyspaces.tables |
Fields
The following fields are returned by SELECT queries:
- get_table
- list_tables
| Name | Datatype | Description |
|---|---|---|
capacity_specification | object | The read/write throughput capacity mode for a table. The options are: throughputMode:PAY_PER_REQUEST throughputMode:PROVISIONED |
cdc_specification | object | The CDC stream settings of the table. |
client_side_timestamps | object | The client-side timestamps setting of the table. |
comment | object | The the description of the specified table. |
creation_timestamp | string (date-time) | The creation timestamp of the specified table. |
default_time_to_live | integer | The default Time to Live settings in seconds of the specified table. |
encryption_specification | object | The encryption settings of the specified table. |
keyspace_name | string | The name of the keyspace that the specified table is stored in. (pattern: <code>[a-zA-Z0-9][a-zA-Z0-9_]{0,47}</code>) |
latest_stream_arn | string | The Amazon Resource Name (ARN) of the stream. (pattern: <code>arn:(aws[a-zA-Z0-9-]):cassandra:.+.</code>) |
point_in_time_recovery | object | The point-in-time recovery status of the specified table. |
replica_specifications | array | Returns the Amazon Web Services Region specific settings of all Regions a multi-Region table is replicated in. |
resource_arn | string | The Amazon Resource Name (ARN) of the specified table. (pattern: <code>arn:(aws[a-zA-Z0-9-]):cassandra:.+.</code>) |
schema_definition | object | The schema definition of the specified table. |
status | string | The current status of the specified table. (ACTIVE, CREATING, UPDATING, DELETING, DELETED, RESTORING, INACCESSIBLE_ENCRYPTION_CREDENTIALS) |
table_name | string | The name of the specified table. (pattern: <code>[a-zA-Z0-9][a-zA-Z0-9_]{0,47}</code>) |
ttl | object | The custom Time to Live settings of the specified table. |
warm_throughput_specification | object | The warm throughput settings for the table, including the current status and configured read and write capacity units. |
| Name | Datatype | Description |
|---|---|---|
keyspace_name | string | The name of the keyspace that the table is stored in. (pattern: <code>[a-zA-Z0-9][a-zA-Z0-9_]{0,47}</code>) |
resource_arn | string | The unique identifier of the table in the format of an Amazon Resource Name (ARN). (pattern: <code>arn:(aws[a-zA-Z0-9-]):cassandra:.+.</code>) |
table_name | string | The name of the table. (pattern: <code>[a-zA-Z0-9][a-zA-Z0-9_]{0,47}</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_table | select | region | Returns information about the table, including the table's name and current status, the keyspace name, configuration settings, and metadata. To read table metadata using GetTable, the IAM principal needs Select action permissions for the table and the system keyspace. | |
list_tables | select | region | The ListTables operation returns a list of tables for a specified keyspace. To read keyspace metadata using ListTables, the IAM principal needs Select action permissions for the system keyspace. | |
create_table | insert | region, keyspaceName, tableName, schemaDefinition | The CreateTable operation adds a new table to the specified keyspace. Within a keyspace, table names must be unique. CreateTable is an asynchronous operation. When the request is received, the status of the table is set to CREATING. You can monitor the creation status of the new table by using the GetTable operation, which returns the current status of the table. You can start using a table when the status is ACTIVE. For more information, see Create a table in the Amazon Keyspaces Developer Guide. | |
update_table | update | region, keyspaceName, tableName | Adds new columns to the table or updates one of the table's settings, for example capacity mode, auto scaling, encryption, point-in-time recovery, or ttl settings. Note that you can only update one specific table setting per update operation. | |
delete_table | delete | region | The DeleteTable operation deletes a table and all of its data. After a DeleteTable request is received, the specified table is in the DELETING state until Amazon Keyspaces completes the deletion. If the table is in the ACTIVE state, you can delete it. If a table is either in the CREATING or UPDATING states, then Amazon Keyspaces returns a ResourceInUseException. If the specified table does not exist, Amazon Keyspaces returns a ResourceNotFoundException. If the table is already in the DELETING state, no error is returned. |
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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_table
- list_tables
Returns information about the table, including the table's name and current status, the keyspace name, configuration settings, and metadata. To read table metadata using GetTable, the IAM principal needs Select action permissions for the table and the system keyspace.
SELECT
capacity_specification,
cdc_specification,
client_side_timestamps,
comment,
creation_timestamp,
default_time_to_live,
encryption_specification,
keyspace_name,
latest_stream_arn,
point_in_time_recovery,
replica_specifications,
resource_arn,
schema_definition,
status,
table_name,
ttl,
warm_throughput_specification
FROM aws.keyspaces.tables
WHERE region = '{{ region }}' -- required
;
The ListTables operation returns a list of tables for a specified keyspace. To read keyspace metadata using ListTables, the IAM principal needs Select action permissions for the system keyspace.
SELECT
keyspace_name,
resource_arn,
table_name
FROM aws.keyspaces.tables
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_table
- Manifest
The CreateTable operation adds a new table to the specified keyspace. Within a keyspace, table names must be unique. CreateTable is an asynchronous operation. When the request is received, the status of the table is set to CREATING. You can monitor the creation status of the new table by using the GetTable operation, which returns the current status of the table. You can start using a table when the status is ACTIVE. For more information, see Create a table in the Amazon Keyspaces Developer Guide.
INSERT INTO aws.keyspaces.tables (
keyspaceName,
tableName,
schemaDefinition,
comment,
capacitySpecification,
encryptionSpecification,
pointInTimeRecovery,
ttl,
defaultTimeToLive,
tags,
clientSideTimestamps,
autoScalingSpecification,
replicaSpecifications,
cdcSpecification,
warmThroughputSpecification,
region
)
SELECT
'{{ keyspaceName }}' /* required */,
'{{ tableName }}' /* required */,
'{{ schemaDefinition }}' /* required */,
'{{ comment }}',
'{{ capacitySpecification }}',
'{{ encryptionSpecification }}',
'{{ pointInTimeRecovery }}',
'{{ ttl }}',
{{ defaultTimeToLive }},
'{{ tags }}',
'{{ clientSideTimestamps }}',
'{{ autoScalingSpecification }}',
'{{ replicaSpecifications }}',
'{{ cdcSpecification }}',
'{{ warmThroughputSpecification }}',
'{{ region }}'
RETURNING
resource_arn
;
# Description fields are for documentation purposes
- name: tables
props:
- name: region
value: "{{ region }}"
description: Required parameter for the tables resource.
- name: keyspaceName
value: "{{ keyspaceName }}"
description: |
The name of the keyspace that the table is going to be created in.
- name: tableName
value: "{{ tableName }}"
description: |
The name of the table.
- name: schemaDefinition
description: |
The schemaDefinition consists of the following parameters. For each column to be created: name - The name of the column. type - An Amazon Keyspaces data type. For more information, see Data types in the Amazon Keyspaces Developer Guide. The primary key of the table consists of the following columns: partitionKeys - The partition key can be a single column, or it can be a compound value composed of two or more columns. The partition key portion of the primary key is required and determines how Amazon Keyspaces stores your data. name - The name of each partition key column. clusteringKeys - The optional clustering column portion of your primary key determines how the data is clustered and sorted within each partition. name - The name of the clustering column. orderBy - Sets the ascendant (ASC) or descendant (DESC) order modifier. To define a column as static use staticColumns - Static columns store values that are shared by all rows in the same partition: name - The name of the column. type - An Amazon Keyspaces data type.
value:
allColumns:
- name: "{{ name }}"
type_: "{{ type_ }}"
partitionKeys:
- name: "{{ name }}"
clusteringKeys:
- name: "{{ name }}"
orderBy: "{{ orderBy }}"
staticColumns:
- name: "{{ name }}"
- name: comment
description: |
This parameter allows to enter a description of the table.
value:
message: "{{ message }}"
- name: capacitySpecification
description: |
Specifies the read/write throughput capacity mode for the table. The options are: throughputMode:PAY_PER_REQUEST and throughputMode:PROVISIONED - Provisioned capacity mode requires readCapacityUnits and writeCapacityUnits as input. The default is throughput_mode:PAY_PER_REQUEST. For more information, see Read/write capacity modes in the Amazon Keyspaces Developer Guide.
value:
throughputMode: "{{ throughputMode }}"
readCapacityUnits: {{ readCapacityUnits }}
writeCapacityUnits: {{ writeCapacityUnits }}
- name: encryptionSpecification
description: |
Specifies how the encryption key for encryption at rest is managed for the table. You can choose one of the following KMS key (KMS key): type:AWS_OWNED_KMS_KEY - This key is owned by Amazon Keyspaces. type:CUSTOMER_MANAGED_KMS_KEY - This key is stored in your account and is created, owned, and managed by you. This option requires the kms_key_identifier of the KMS key in Amazon Resource Name (ARN) format as input. The default is type:AWS_OWNED_KMS_KEY. For more information, see Encryption at rest in the Amazon Keyspaces Developer Guide.
value:
type_: "{{ type_ }}"
kmsKeyIdentifier: "{{ kmsKeyIdentifier }}"
- name: pointInTimeRecovery
description: |
Specifies if pointInTimeRecovery is enabled or disabled for the table. The options are: status=ENABLED status=DISABLED If it's not specified, the default is status=DISABLED. For more information, see Point-in-time recovery in the Amazon Keyspaces Developer Guide.
value:
status: "{{ status }}"
- name: ttl
description: |
Enables Time to Live custom settings for the table. The options are: status:enabled status:disabled The default is status:disabled. After ttl is enabled, you can't disable it for the table. For more information, see Expiring data by using Amazon Keyspaces Time to Live (TTL) in the Amazon Keyspaces Developer Guide.
value:
status: "{{ status }}"
- name: defaultTimeToLive
value: {{ defaultTimeToLive }}
description: |
The default Time to Live setting in seconds for the table. For more information, see Setting the default TTL value for a table in the Amazon Keyspaces Developer Guide.
- name: tags
description: |
A list of key-value pair tags to be attached to the resource. For more information, see Adding tags and labels to Amazon Keyspaces resources in the Amazon Keyspaces Developer Guide.
value:
- key: "{{ key }}"
value: "{{ value }}"
- name: clientSideTimestamps
description: |
Enables client-side timestamps for the table. By default, the setting is disabled. You can enable client-side timestamps with the following option: status: "enabled" Once client-side timestamps are enabled for a table, this setting cannot be disabled.
value:
status: "{{ status }}"
- name: autoScalingSpecification
description: |
The optional auto scaling settings for a table in provisioned capacity mode. Specifies if the service can manage throughput capacity automatically on your behalf. Auto scaling helps you provision throughput capacity for variable workloads efficiently by increasing and decreasing your table's read and write capacity automatically in response to application traffic. For more information, see Managing throughput capacity automatically with Amazon Keyspaces auto scaling in the Amazon Keyspaces Developer Guide. By default, auto scaling is disabled for a table.
value:
writeCapacityAutoScaling:
autoScalingDisabled: {{ autoScalingDisabled }}
minimumUnits: {{ minimumUnits }}
maximumUnits: {{ maximumUnits }}
scalingPolicy:
targetTrackingScalingPolicyConfiguration:
disableScaleIn: {{ disableScaleIn }}
scaleInCooldown: {{ scaleInCooldown }}
scaleOutCooldown: {{ scaleOutCooldown }}
targetValue: {{ targetValue }}
readCapacityAutoScaling:
autoScalingDisabled: {{ autoScalingDisabled }}
minimumUnits: {{ minimumUnits }}
maximumUnits: {{ maximumUnits }}
scalingPolicy:
targetTrackingScalingPolicyConfiguration:
disableScaleIn: {{ disableScaleIn }}
scaleInCooldown: {{ scaleInCooldown }}
scaleOutCooldown: {{ scaleOutCooldown }}
targetValue: {{ targetValue }}
- name: replicaSpecifications
description: |
The optional Amazon Web Services Region specific settings of a multi-Region table. These settings overwrite the general settings of the table for the specified Region. For a multi-Region table in provisioned capacity mode, you can configure the table's read capacity differently for each Region's replica. The write capacity, however, remains synchronized between all replicas to ensure that there's enough capacity to replicate writes across all Regions. To define the read capacity for a table replica in a specific Region, you can do so by configuring the following parameters. region: The Region where these settings are applied. (Required) readCapacityUnits: The provisioned read capacity units. (Optional) readCapacityAutoScaling: The read capacity auto scaling settings for the table. (Optional)
value:
- region: "{{ region }}"
readCapacityUnits: {{ readCapacityUnits }}
readCapacityAutoScaling:
autoScalingDisabled: {{ autoScalingDisabled }}
minimumUnits: {{ minimumUnits }}
maximumUnits: {{ maximumUnits }}
scalingPolicy:
targetTrackingScalingPolicyConfiguration:
disableScaleIn: {{ disableScaleIn }}
scaleInCooldown: {{ scaleInCooldown }}
scaleOutCooldown: {{ scaleOutCooldown }}
targetValue: {{ targetValue }}
- name: cdcSpecification
description: |
The CDC stream settings of the table.
value:
status: "{{ status }}"
viewType: "{{ viewType }}"
tags:
- key: "{{ key }}"
value: "{{ value }}"
propagateTags: "{{ propagateTags }}"
- name: warmThroughputSpecification
description: |
Specifies the warm throughput settings for the table. Pre-warming a table helps you avoid capacity exceeded exceptions by pre-provisioning read and write capacity units to reduce cold start latency when your table receives traffic. For more information about pre-warming in Amazon Keyspaces, see Pre-warm a table in Amazon Keyspaces in the Amazon Keyspaces Developer Guide.
value:
readUnitsPerSecond: {{ readUnitsPerSecond }}
writeUnitsPerSecond: {{ writeUnitsPerSecond }}
UPDATE examples
- update_table
Adds new columns to the table or updates one of the table's settings, for example capacity mode, auto scaling, encryption, point-in-time recovery, or ttl settings. Note that you can only update one specific table setting per update operation.
UPDATE aws.keyspaces.tables
SET
keyspaceName = '{{ keyspaceName }}',
tableName = '{{ tableName }}',
addColumns = '{{ addColumns }}',
capacitySpecification = '{{ capacitySpecification }}',
encryptionSpecification = '{{ encryptionSpecification }}',
pointInTimeRecovery = '{{ pointInTimeRecovery }}',
ttl = '{{ ttl }}',
defaultTimeToLive = {{ defaultTimeToLive }},
clientSideTimestamps = '{{ clientSideTimestamps }}',
autoScalingSpecification = '{{ autoScalingSpecification }}',
replicaSpecifications = '{{ replicaSpecifications }}',
cdcSpecification = '{{ cdcSpecification }}',
warmThroughputSpecification = '{{ warmThroughputSpecification }}'
WHERE
region = '{{ region }}' --required
AND keyspaceName = '{{ keyspaceName }}' --required
AND tableName = '{{ tableName }}' --required
RETURNING
resource_arn;
DELETE examples
- delete_table
The DeleteTable operation deletes a table and all of its data. After a DeleteTable request is received, the specified table is in the DELETING state until Amazon Keyspaces completes the deletion. If the table is in the ACTIVE state, you can delete it. If a table is either in the CREATING or UPDATING states, then Amazon Keyspaces returns a ResourceInUseException. If the specified table does not exist, Amazon Keyspaces returns a ResourceNotFoundException. If the table is already in the DELETING state, no error is returned.
DELETE FROM aws.keyspaces.tables
WHERE region = '{{ region }}' --required
;