Skip to content

restore_table async

restore_table(
    source_keyspace_name: KeyspaceName,
    source_table_name: TableName,
    target_keyspace_name: KeyspaceName,
    target_table_name: TableName,
    *,
    config_overrides: Optional[AsyncKeyspacesClientConfig] = None,
    restore_timestamp: Optional[Timestamp] = None,
    capacity_specification_override: Optional[CapacitySpecification] = None,
    encryption_specification_override: Optional[EncryptionSpecification] = None,
    point_in_time_recovery_override: Optional[PointInTimeRecovery] = None,
    tags_override: Optional[TagList] = None,
    auto_scaling_specification: Optional[AutoScalingSpecification] = None,
    replica_specifications: Optional[ReplicaSpecificationList] = None,
) -> RestoreTableResponse

Restores the table to the specified point in time within the earliest_restorable_timestamp and the current time. For more information about restore points, see Time window for PITR continuous backups in the Amazon Keyspaces Developer Guide.

Any number of users can execute up to 4 concurrent restores (any type of restore) in a given account.

When you restore using point in time recovery, Amazon Keyspaces restores your source table's schema and data to the state based on the selected timestamp (day:hour:minute:second) to a new table. The Time to Live (TTL) settings are also restored to the state based on the selected timestamp.

In addition to the table's schema, data, and TTL settings, RestoreTable restores the capacity mode, auto scaling settings, encryption settings, and point-in-time recovery settings from the source table. Unlike the table's schema data and TTL settings, which are restored based on the selected timestamp, these settings are always restored based on the table's settings as of the current time or when the table was deleted.

You can also overwrite these settings during restore:

  • Read/write capacity mode

  • Provisioned throughput capacity units

  • Auto scaling settings

  • Point-in-time (PITR) settings

  • Tags

For more information, see PITR restore settings in the Amazon Keyspaces Developer Guide.

Note that the following settings are not restored, and you must configure them manually for the new table:

  • Identity and Access Management (IAM) policies

  • Amazon CloudWatch metrics and alarms

Parameters:

  • source_keyspace_name (KeyspaceName) –

    The keyspace name of the source table.

  • source_table_name (TableName) –

    The name of the source table.

  • target_keyspace_name (KeyspaceName) –

    The name of the target keyspace.

  • target_table_name (TableName) –

    The name of the target table.

  • restore_timestamp (Optional[Timestamp], default: None ) –

    The restore timestamp in ISO 8601 format.

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

    Specifies the read/write throughput capacity mode for the target table. The options are:

    • throughputMode:PAY_PER_REQUEST

    • 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_override (Optional[EncryptionSpecification], default: None ) –

    Specifies the encryption settings for the target 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.

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

    Specifies the pointInTimeRecovery settings for the target 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.

  • tags_override (Optional[TagList], default: None ) –

    A list of key-value pair tags to be attached to the restored table.

    For more information, see Adding tags and labels to Amazon Keyspaces resources in the Amazon Keyspaces Developer Guide.

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

    The optional auto scaling settings for the restored 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.

    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 optional Region specific settings of a multi-Regional table.

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 restore_table(
    self,
    source_keyspace_name: "capo_keyspaces.types.keyspace_name.KeyspaceName",
    source_table_name: "capo_keyspaces.types.table_name.TableName",
    target_keyspace_name: "capo_keyspaces.types.keyspace_name.KeyspaceName",
    target_table_name: "capo_keyspaces.types.table_name.TableName",
    *,
    config_overrides: Optional[AsyncKeyspacesClientConfig] = None,
    restore_timestamp: Optional["capo_keyspaces.types.timestamp.Timestamp"] = None,
    capacity_specification_override: Optional[
        "capo_keyspaces.types.capacity_specification.CapacitySpecification"
    ] = None,
    encryption_specification_override: Optional[
        "capo_keyspaces.types.encryption_specification.EncryptionSpecification"
    ] = None,
    point_in_time_recovery_override: Optional[
        "capo_keyspaces.types.point_in_time_recovery.PointInTimeRecovery"
    ] = None,
    tags_override: Optional["capo_keyspaces.types.tag_list.TagList"] = None,
    auto_scaling_specification: Optional[
        "capo_keyspaces.types.auto_scaling_specification.AutoScalingSpecification"
    ] = None,
    replica_specifications: Optional[
        "capo_keyspaces.types.replica_specification_list.ReplicaSpecificationList"
    ] = None,
) -> "capo_keyspaces.types.restore_table_response.RestoreTableResponse":
    """<p>Restores the table to the specified point in time within the <code>earliest_restorable_timestamp</code> and the current time. For more information about restore points, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/PointInTimeRecovery_HowItWorks.html#howitworks_backup_window"> Time window for PITR continuous backups</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p> <p>Any number of users can execute up to 4 concurrent restores (any type of restore) in a given account.</p> <p>When you restore using point in time recovery, Amazon Keyspaces restores your source table's schema and data to the state based on the selected timestamp <code>(day:hour:minute:second)</code> to a new table. The Time to Live (TTL) settings are also restored to the state based on the selected timestamp.</p> <p>In addition to the table's schema, data, and TTL settings, <code>RestoreTable</code> restores the capacity mode, auto scaling settings, encryption settings, and point-in-time recovery settings from the source table. Unlike the table's schema data and TTL settings, which are restored based on the selected timestamp, these settings are always restored based on the table's settings as of the current time or when the table was deleted.</p> <p>You can also overwrite these settings during restore:</p> <ul> <li> <p>Read/write capacity mode</p> </li> <li> <p>Provisioned throughput capacity units</p> </li> <li> <p>Auto scaling settings</p> </li> <li> <p>Point-in-time (PITR) settings</p> </li> <li> <p>Tags</p> </li> </ul> <p>For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/PointInTimeRecovery_HowItWorks.html#howitworks_backup_settings">PITR restore settings</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p> <p>Note that the following settings are not restored, and you must configure them manually for the new table:</p> <ul> <li> <p>Identity and Access Management (IAM) policies</p> </li> <li> <p>Amazon CloudWatch metrics and alarms</p> </li> </ul>

    Args:
        source_keyspace_name: <p>The keyspace name of the source table.</p>
        source_table_name: <p>The name of the source table.</p>
        target_keyspace_name: <p>The name of the target keyspace.</p>
        target_table_name: <p>The name of the target table.</p>
        restore_timestamp: <p>The restore timestamp in ISO 8601 format.</p>
        capacity_specification_override: <p>Specifies the read/write throughput capacity mode for the target table. The options are:</p> <ul> <li> <p> <code>throughputMode:PAY_PER_REQUEST</code> </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_override: <p>Specifies the encryption settings for the target 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>type: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_override: <p>Specifies the <code>pointInTimeRecovery</code> settings for the target 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>
        tags_override: <p>A list of key-value pair tags to be attached to the restored table. </p> <p>For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/tagging-keyspaces.html">Adding tags and labels to Amazon Keyspaces resources</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
        auto_scaling_specification: <p>The optional auto scaling settings for the restored 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>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 optional Region specific settings of a multi-Regional table.</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.restore_table_request.RestoreTableRequest]",
    ) -> AsyncOperationResponse[
        "capo_keyspaces.types.restore_table_response.RestoreTableResponse"
    ]:
        import capo_keyspaces._operations.keyspaces_service.restore_table

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RestoreTable")
    )
    input_: capo_keyspaces.types.restore_table_request.RestoreTableRequest = {
        "source_keyspace_name": source_keyspace_name,
        "source_table_name": source_table_name,
        "target_keyspace_name": target_keyspace_name,
        "target_table_name": target_table_name,
    }
    if restore_timestamp is not None:
        input_["restore_timestamp"] = restore_timestamp
    if capacity_specification_override is not None:
        input_["capacity_specification_override"] = capacity_specification_override
    if encryption_specification_override is not None:
        input_["encryption_specification_override"] = (
            encryption_specification_override
        )
    if point_in_time_recovery_override is not None:
        input_["point_in_time_recovery_override"] = point_in_time_recovery_override
    if tags_override is not None:
        input_["tags_override"] = tags_override
    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

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