Skip to content

update_table async

update_table(
    keyspace_name: KeyspaceName,
    table_name: TableName,
    *,
    config_overrides: Optional[AsyncKeyspacesClientConfig] = None,
    add_columns: Optional[ColumnDefinitionList] = None,
    capacity_specification: Optional[CapacitySpecification] = None,
    encryption_specification: Optional[EncryptionSpecification] = None,
    point_in_time_recovery: Optional[PointInTimeRecovery] = None,
    ttl: Optional[TimeToLive] = None,
    default_time_to_live: Optional[DefaultTimeToLive] = None,
    client_side_timestamps: Optional[ClientSideTimestamps] = None,
    auto_scaling_specification: Optional[AutoScalingSpecification] = None,
    replica_specifications: Optional[ReplicaSpecificationList] = None,
    cdc_specification: Optional[CdcSpecification] = None,
    warm_throughput_specification: Optional[WarmThroughputSpecification] = None,
) -> UpdateTableResponse

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.

Parameters:

  • keyspace_name (KeyspaceName) –

    The name of the keyspace the specified table is stored in.

  • table_name (TableName) –

    The name of the table.

  • add_columns (Optional[ColumnDefinitionList], default: None ) –

    For each column to be added to the specified table:

    • name - The name of the column.

    • type - An Amazon Keyspaces data type. For more information, see Data types in the Amazon Keyspaces Developer Guide.

  • capacity_specification (Optional[CapacitySpecification], default: None ) –

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

  • encryption_specification (Optional[EncryptionSpecification], default: None ) –

    Modifies the encryption settings of 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 AWS_OWNED_KMS_KEY.

    For more information, see Encryption at rest in the Amazon Keyspaces Developer Guide.

  • point_in_time_recovery (Optional[PointInTimeRecovery], default: None ) –

    Modifies the pointInTimeRecovery settings of 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.

  • ttl (Optional[TimeToLive], default: None ) –

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

  • default_time_to_live (Optional[DefaultTimeToLive], default: None ) –

    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.

  • client_side_timestamps (Optional[ClientSideTimestamps], default: None ) –

    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.

  • auto_scaling_specification (Optional[AutoScalingSpecification], default: None ) –

    The optional auto scaling settings to update for a table in provisioned capacity mode. Specifies if the service can manage throughput capacity of a provisioned table automatically on your behalf. Amazon Keyspaces 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.

    If auto scaling is already enabled for the table, you can use UpdateTable to update the minimum and maximum values or the auto scaling policy settings independently.

    For more information, see Managing throughput capacity automatically with Amazon Keyspaces auto scaling in the Amazon Keyspaces Developer Guide.

  • replica_specifications (Optional[ReplicaSpecificationList], default: None ) –

    The Region specific settings of a multi-Regional table.

  • cdc_specification (Optional[CdcSpecification], default: None ) –

    The CDC stream settings of the table.

  • warm_throughput_specification (Optional[WarmThroughputSpecification], default: None ) –

    Modifies the warm throughput settings for the table. You can update the read and write capacity units to adjust the pre-provisioned throughput.

Raises:

  • AccessDeniedException –

    You don't have sufficient access permissions to perform this action.

  • ConflictException –

    Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an action and the same or a different action is already in progress, or if you try to create a resource that already exists.

  • InternalServerException –

    Amazon Keyspaces was unable to fully process this request because of an internal server error.

  • ResourceNotFoundException –

    The operation tried to access a keyspace, table, or type that doesn't exist. The resource might not be specified correctly, or its status might not be ACTIVE.

  • ServiceQuotaExceededException –

    The operation exceeded the service quota for this resource. For more information on service quotas, see Quotas in the Amazon Keyspaces Developer Guide.

  • ValidationException –

    The operation failed due to an invalid or malformed request.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_keyspaces/_services/async_keyspaces.py
async def update_table(
    self,
    keyspace_name: "capo_keyspaces.types.keyspace_name.KeyspaceName",
    table_name: "capo_keyspaces.types.table_name.TableName",
    *,
    config_overrides: Optional[AsyncKeyspacesClientConfig] = None,
    add_columns: Optional[
        "capo_keyspaces.types.column_definition_list.ColumnDefinitionList"
    ] = None,
    capacity_specification: Optional[
        "capo_keyspaces.types.capacity_specification.CapacitySpecification"
    ] = None,
    encryption_specification: Optional[
        "capo_keyspaces.types.encryption_specification.EncryptionSpecification"
    ] = None,
    point_in_time_recovery: Optional[
        "capo_keyspaces.types.point_in_time_recovery.PointInTimeRecovery"
    ] = None,
    ttl: Optional["capo_keyspaces.types.time_to_live.TimeToLive"] = None,
    default_time_to_live: Optional[
        "capo_keyspaces.types.default_time_to_live.DefaultTimeToLive"
    ] = None,
    client_side_timestamps: Optional[
        "capo_keyspaces.types.client_side_timestamps.ClientSideTimestamps"
    ] = None,
    auto_scaling_specification: Optional[
        "capo_keyspaces.types.auto_scaling_specification.AutoScalingSpecification"
    ] = None,
    replica_specifications: Optional[
        "capo_keyspaces.types.replica_specification_list.ReplicaSpecificationList"
    ] = None,
    cdc_specification: Optional[
        "capo_keyspaces.types.cdc_specification.CdcSpecification"
    ] = None,
    warm_throughput_specification: Optional[
        "capo_keyspaces.types.warm_throughput_specification.WarmThroughputSpecification"
    ] = None,
) -> "capo_keyspaces.types.update_table_response.UpdateTableResponse":
    """<p>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.</p>

    Args:
        keyspace_name: <p>The name of the keyspace the specified table is stored in.</p>
        table_name: <p>The name of the table.</p>
        add_columns: <p>For each column to be added to the specified table:</p> <ul> <li> <p> <code>name</code> - The name of the column.</p> </li> <li> <p> <code>type</code> - An Amazon Keyspaces data type. For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/cql.elements.html#cql.data-types">Data types</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p> </li> </ul>
        capacity_specification: <p>Modifies the read/write throughput capacity mode for the table. The options are:</p> <ul> <li> <p> <code>throughputMode:PAY_PER_REQUEST</code> and </p> </li> <li> <p> <code>throughputMode:PROVISIONED</code> - Provisioned capacity mode requires <code>readCapacityUnits</code> and <code>writeCapacityUnits</code> as input.</p> </li> </ul> <p>The default is <code>throughput_mode:PAY_PER_REQUEST</code>.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/ReadWriteCapacityMode.html">Read/write capacity modes</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
        encryption_specification: <p>Modifies the encryption settings of the table. You can choose one of the following KMS key (KMS key):</p> <ul> <li> <p> <code>type:AWS_OWNED_KMS_KEY</code> - This key is owned by Amazon Keyspaces. </p> </li> <li> <p> <code>type:CUSTOMER_MANAGED_KMS_KEY</code> - This key is stored in your account and is created, owned, and managed by you. This option requires the <code>kms_key_identifier</code> of the KMS key in Amazon Resource Name (ARN) format as input. </p> </li> </ul> <p>The default is <code>AWS_OWNED_KMS_KEY</code>.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/EncryptionAtRest.html">Encryption at rest</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
        point_in_time_recovery: <p>Modifies the <code>pointInTimeRecovery</code> settings of the table. The options are:</p> <ul> <li> <p> <code>status=ENABLED</code> </p> </li> <li> <p> <code>status=DISABLED</code> </p> </li> </ul> <p>If it's not specified, the default is <code>status=DISABLED</code>.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/PointInTimeRecovery.html">Point-in-time recovery</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
        ttl: <p>Modifies Time to Live custom settings for the table. The options are:</p> <ul> <li> <p> <code>status:enabled</code> </p> </li> <li> <p> <code>status:disabled</code> </p> </li> </ul> <p>The default is <code>status:disabled</code>. After <code>ttl</code> is enabled, you can't disable it for the table.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/TTL.html">Expiring data by using Amazon Keyspaces Time to Live (TTL)</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
        default_time_to_live: <p>The default Time to Live setting in seconds for the table.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/TTL-how-it-works.html#ttl-howitworks_default_ttl">Setting the default TTL value for a table</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
        client_side_timestamps: <p>Enables client-side timestamps for the table. By default, the setting is disabled. You can enable client-side timestamps with the following option:</p> <ul> <li> <p> <code>status: "enabled"</code> </p> </li> </ul> <p>Once client-side timestamps are enabled for a table, this setting cannot be disabled.</p>
        auto_scaling_specification: <p>The optional auto scaling settings to update for a table in provisioned capacity mode. Specifies if the service can manage throughput capacity of a provisioned table automatically on your behalf. Amazon Keyspaces 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.</p> <p>If auto scaling is already enabled for the table, you can use <code>UpdateTable</code> to update the minimum and maximum values or the auto scaling policy settings independently.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/autoscaling.html">Managing throughput capacity automatically with Amazon Keyspaces auto scaling</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
        replica_specifications: <p>The Region specific settings of a multi-Regional table.</p>
        cdc_specification: <p>The CDC stream settings of the table.</p>
        warm_throughput_specification: <p>Modifies the warm throughput settings for the table. You can update the read and write capacity units to adjust the pre-provisioned throughput.</p>

    Raises:
        capo_keyspaces.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access permissions to perform this action. </p>
        capo_keyspaces.errors.conflict_exception.ConflictException: <p>Amazon Keyspaces couldn't complete the requested action. This error may occur if you try to perform an action and the same or a different action is already in progress, or if you try to create a resource that already exists. </p>
        capo_keyspaces.errors.internal_server_exception.InternalServerException: <p>Amazon Keyspaces was unable to fully process this request because of an internal server error.</p>
        capo_keyspaces.errors.resource_not_found_exception.ResourceNotFoundException: <p>The operation tried to access a keyspace, table, or type that doesn't exist. The resource might not be specified correctly, or its status might not be <code>ACTIVE</code>.</p>
        capo_keyspaces.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The operation exceeded the service quota for this resource. For more information on service quotas, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/quotas.html">Quotas</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
        capo_keyspaces.errors.validation_exception.ValidationException: <p>The operation failed due to an invalid or malformed request.</p>
        capo_keyspaces.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_keyspaces.types.update_table_request.UpdateTableRequest]",
    ) -> AsyncOperationResponse[
        "capo_keyspaces.types.update_table_response.UpdateTableResponse"
    ]:
        import capo_keyspaces._operations.keyspaces_service.update_table

        (
            output,
            http_response,
        ) = await capo_keyspaces._operations.keyspaces_service.update_table.async_update_table(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateTable")
    )
    input_: capo_keyspaces.types.update_table_request.UpdateTableRequest = {
        "keyspace_name": keyspace_name,
        "table_name": table_name,
    }
    if add_columns is not None:
        input_["add_columns"] = add_columns
    if capacity_specification is not None:
        input_["capacity_specification"] = capacity_specification
    if encryption_specification is not None:
        input_["encryption_specification"] = encryption_specification
    if point_in_time_recovery is not None:
        input_["point_in_time_recovery"] = point_in_time_recovery
    if ttl is not None:
        input_["ttl"] = ttl
    if default_time_to_live is not None:
        input_["default_time_to_live"] = default_time_to_live
    if client_side_timestamps is not None:
        input_["client_side_timestamps"] = client_side_timestamps
    if auto_scaling_specification is not None:
        input_["auto_scaling_specification"] = auto_scaling_specification
    if replica_specifications is not None:
        input_["replica_specifications"] = replica_specifications
    if cdc_specification is not None:
        input_["cdc_specification"] = cdc_specification
    if warm_throughput_specification is not None:
        input_["warm_throughput_specification"] = warm_throughput_specification

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output