Skip to content

restore_table_to_point_in_time

restore_table_to_point_in_time(
    target_table_name: TableName,
    *,
    config_overrides: Optional[DynamoDBClientConfig] = None,
    source_table_arn: Optional[TableArn] = None,
    source_table_name: Optional[TableName] = None,
    use_latest_restorable_time: Optional[BooleanObject] = None,
    restore_date_time: Optional[Date] = None,
    billing_mode_override: Optional[BillingMode] = None,
    global_secondary_index_override: Optional[GlobalSecondaryIndexList] = None,
    local_secondary_index_override: Optional[LocalSecondaryIndexList] = None,
    provisioned_throughput_override: Optional[ProvisionedThroughput] = None,
    on_demand_throughput_override: Optional[OnDemandThroughput] = None,
    sse_specification_override: Optional[SSESpecification] = None,
    vector_index_override: Optional[VectorIndexList] = None,
) -> RestoreTableToPointInTimeOutput

Restores the specified table to the specified point in time within EarliestRestorableDateTime and LatestRestorableDateTime. You can restore your table to any point in time in the last 35 days. You can set the recovery period to any value between 1 and 35 days. Any number of users can execute up to 50 concurrent restores (any type of restore) in a given account.

When you restore using point in time recovery, DynamoDB restores your table data to the state based on the selected date and time (day:hour:minute:second) to a new table.

Along with data, the following are also included on the new restored table using point in time recovery:

  • Global secondary indexes (GSIs)

  • Local secondary indexes (LSIs)

  • Provisioned read and write capacity

  • Encryption settings

    All these settings come from the current settings of the source table at the time of restore.

You must manually set up the following on the restored table:

  • Auto scaling policies

  • IAM policies

  • Amazon CloudWatch metrics and alarms

  • Tags

  • Stream settings

  • Time to Live (TTL) settings

  • Point in time recovery settings

Parameters:

  • source_table_arn (Optional[TableArn], default: None ) –

    The DynamoDB table that will be restored. This value is an Amazon Resource Name (ARN).

  • source_table_name (Optional[TableName], default: None ) –

    Name of the source table that is being restored.

  • target_table_name (TableName) –

    The name of the new table to which it must be restored to.

  • use_latest_restorable_time (Optional[BooleanObject], default: None ) –

    Restore the table to the latest possible time. LatestRestorableDateTime is typically 5 minutes before the current time.

  • restore_date_time (Optional[Date], default: None ) –

    Time in the past to restore the table to.

  • billing_mode_override (Optional[BillingMode], default: None ) –

    The billing mode of the restored table.

  • global_secondary_index_override (Optional[GlobalSecondaryIndexList], default: None ) –

    List of global secondary indexes for the restored table. The indexes provided should match existing secondary indexes. You can choose to exclude some or all of the indexes at the time of restore.

    The WarmThroughput setting is not supported on global secondary indexes when you use RestoreTableToPointInTime. Although WarmThroughput appears in the shared index definition, including it in a GlobalSecondaryIndexOverride entry causes the request to fail with a validation error.

  • local_secondary_index_override (Optional[LocalSecondaryIndexList], default: None ) –

    List of local secondary indexes for the restored table. The indexes provided should match existing secondary indexes. You can choose to exclude some or all of the indexes at the time of restore.

  • provisioned_throughput_override (Optional[ProvisionedThroughput], default: None ) –

    Provisioned throughput settings for the restored table.

  • sse_specification_override (Optional[SSESpecification], default: None ) –

    The new server-side encryption settings for the restored table.

  • vector_index_override (Optional[VectorIndexList], default: None ) –

    The vector indexes for the restored table. If not specified, all vector indexes from the source table are restored. The indexes provided must match existing vector indexes from the source table. You can choose to exclude some or all of the vector indexes at the time of restore.

Raises:

  • InternalServerError –

    An error occurred on the server side.

  • InvalidRestoreTimeException –

    An invalid restore time was specified. RestoreDateTime must be between EarliestRestorableDateTime and LatestRestorableDateTime.

  • LimitExceededException –

    There is no limit to the number of daily on-demand backups that can be taken.

    For most purposes, up to 500 simultaneous table operations are allowed per account. These operations include CreateTable, UpdateTable, DeleteTable,UpdateTimeToLive, RestoreTableFromBackup, and RestoreTableToPointInTime.

    When you are creating a table with one or more secondary indexes, you can have up to 250 such requests running at a time. However, if the table or index specifications are complex, then DynamoDB might temporarily reduce the number of concurrent operations.

    When importing into DynamoDB, up to 50 simultaneous import table operations are allowed per account.

    There is a soft account quota of 2,500 tables.

    GetRecords was called with a value of more than 1000 for the limit request parameter.

    More than 2 processes are reading from the same streams shard at the same time. Exceeding this limit may result in request throttling.

  • PointInTimeRecoveryUnavailableException –

    Point in time recovery has not yet been enabled for this source table.

  • TableAlreadyExistsException –

    A target table with the specified name already exists.

  • TableInUseException –

    A target table with the specified name is either being created or deleted.

  • TableNotFoundException –

    A source table with the name TableName does not currently exist within the subscriber's account or the subscriber is operating in the wrong Amazon Web Services Region.

  • UnknownServiceError –

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

Source code in docs_src/capo_dynamodb/_services/dynamo_db.py
def restore_table_to_point_in_time(
    self,
    target_table_name: "capo_dynamodb.types.table_name.TableName",
    *,
    config_overrides: Optional[DynamoDBClientConfig] = None,
    source_table_arn: Optional["capo_dynamodb.types.table_arn.TableArn"] = None,
    source_table_name: Optional["capo_dynamodb.types.table_name.TableName"] = None,
    use_latest_restorable_time: Optional[
        "capo_dynamodb.types.boolean_object.BooleanObject"
    ] = None,
    restore_date_time: Optional["capo_dynamodb.types.date.Date"] = None,
    billing_mode_override: Optional[
        "capo_dynamodb.types.billing_mode.BillingMode"
    ] = None,
    global_secondary_index_override: Optional[
        "capo_dynamodb.types.global_secondary_index_list.GlobalSecondaryIndexList"
    ] = None,
    local_secondary_index_override: Optional[
        "capo_dynamodb.types.local_secondary_index_list.LocalSecondaryIndexList"
    ] = None,
    provisioned_throughput_override: Optional[
        "capo_dynamodb.types.provisioned_throughput.ProvisionedThroughput"
    ] = None,
    on_demand_throughput_override: Optional[
        "capo_dynamodb.types.on_demand_throughput.OnDemandThroughput"
    ] = None,
    sse_specification_override: Optional[
        "capo_dynamodb.types.sse_specification.SSESpecification"
    ] = None,
    vector_index_override: Optional[
        "capo_dynamodb.types.vector_index_list.VectorIndexList"
    ] = None,
) -> "capo_dynamodb.types.restore_table_to_point_in_time_output.RestoreTableToPointInTimeOutput":
    """<p>Restores the specified table to the specified point in time within <code>EarliestRestorableDateTime</code> and <code>LatestRestorableDateTime</code>. You can restore your table to any point in time in the last 35 days. You can set the recovery period to any value between 1 and 35 days. Any number of users can execute up to 50 concurrent restores (any type of restore) in a given account. </p> <p>When you restore using point in time recovery, DynamoDB restores your table data to the state based on the selected date and time (day:hour:minute:second) to a new table. </p> <p>Along with data, the following are also included on the new restored table using point in time recovery: </p> <ul> <li> <p>Global secondary indexes (GSIs)</p> </li> <li> <p>Local secondary indexes (LSIs)</p> </li> <li> <p>Provisioned read and write capacity</p> </li> <li> <p>Encryption settings</p> <important> <p> All these settings come from the current settings of the source table at the time of restore. </p> </important> </li> </ul> <p>You must manually set up the following on the restored table:</p> <ul> <li> <p>Auto scaling policies</p> </li> <li> <p>IAM policies</p> </li> <li> <p>Amazon CloudWatch metrics and alarms</p> </li> <li> <p>Tags</p> </li> <li> <p>Stream settings</p> </li> <li> <p>Time to Live (TTL) settings</p> </li> <li> <p>Point in time recovery settings</p> </li> </ul>

    Args:
        source_table_arn: <p>The DynamoDB table that will be restored. This value is an Amazon Resource Name (ARN).</p>
        source_table_name: <p>Name of the source table that is being restored.</p>
        target_table_name: <p>The name of the new table to which it must be restored to.</p>
        use_latest_restorable_time: <p>Restore the table to the latest possible time. <code>LatestRestorableDateTime</code> is typically 5 minutes before the current time. </p>
        restore_date_time: <p>Time in the past to restore the table to.</p>
        billing_mode_override: <p>The billing mode of the restored table.</p>
        global_secondary_index_override: <p>List of global secondary indexes for the restored table. The indexes provided should match existing secondary indexes. You can choose to exclude some or all of the indexes at the time of restore.</p> <p>The <code>WarmThroughput</code> setting is not supported on global secondary indexes when you use <code>RestoreTableToPointInTime</code>. Although <code>WarmThroughput</code> appears in the shared index definition, including it in a <code>GlobalSecondaryIndexOverride</code> entry causes the request to fail with a validation error.</p>
        local_secondary_index_override: <p>List of local secondary indexes for the restored table. The indexes provided should match existing secondary indexes. You can choose to exclude some or all of the indexes at the time of restore.</p>
        provisioned_throughput_override: <p>Provisioned throughput settings for the restored table.</p>
        sse_specification_override: <p>The new server-side encryption settings for the restored table.</p>
        vector_index_override: <p>The vector indexes for the restored table. If not specified, all vector indexes from the source table are restored. The indexes provided must match existing vector indexes from the source table. You can choose to exclude some or all of the vector indexes at the time of restore.</p>

    Raises:
        capo_dynamodb.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
        capo_dynamodb.errors.invalid_endpoint_exception.InvalidEndpointException
        capo_dynamodb.errors.invalid_restore_time_exception.InvalidRestoreTimeException: <p>An invalid restore time was specified. RestoreDateTime must be between EarliestRestorableDateTime and LatestRestorableDateTime.</p>
        capo_dynamodb.errors.limit_exceeded_exception.LimitExceededException: <p>There is no limit to the number of daily on-demand backups that can be taken. </p> <p>For most purposes, up to 500 simultaneous table operations are allowed per account. These operations include <code>CreateTable</code>, <code>UpdateTable</code>, <code>DeleteTable</code>,<code>UpdateTimeToLive</code>, <code>RestoreTableFromBackup</code>, and <code>RestoreTableToPointInTime</code>. </p> <p>When you are creating a table with one or more secondary indexes, you can have up to 250 such requests running at a time. However, if the table or index specifications are complex, then DynamoDB might temporarily reduce the number of concurrent operations.</p> <p>When importing into DynamoDB, up to 50 simultaneous import table operations are allowed per account.</p> <p>There is a soft account quota of 2,500 tables.</p> <p>GetRecords was called with a value of more than 1000 for the limit request parameter.</p> <p>More than 2 processes are reading from the same streams shard at the same time. Exceeding this limit may result in request throttling.</p>
        capo_dynamodb.errors.point_in_time_recovery_unavailable_exception.PointInTimeRecoveryUnavailableException: <p>Point in time recovery has not yet been enabled for this source table.</p>
        capo_dynamodb.errors.table_already_exists_exception.TableAlreadyExistsException: <p>A target table with the specified name already exists. </p>
        capo_dynamodb.errors.table_in_use_exception.TableInUseException: <p>A target table with the specified name is either being created or deleted. </p>
        capo_dynamodb.errors.table_not_found_exception.TableNotFoundException: <p>A source table with the name <code>TableName</code> does not currently exist within the subscriber's account or the subscriber is operating in the wrong Amazon Web Services Region.</p>
        capo_dynamodb.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_dynamodb.types.restore_table_to_point_in_time_input.RestoreTableToPointInTimeInput]",
    ) -> OperationResponse[
        "capo_dynamodb.types.restore_table_to_point_in_time_output.RestoreTableToPointInTimeOutput"
    ]:
        import capo_dynamodb._operations.dynamo_db_20120810.restore_table_to_point_in_time

        output, http_response = (
            capo_dynamodb._operations.dynamo_db_20120810.restore_table_to_point_in_time.restore_table_to_point_in_time(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RestoreTableToPointInTime")
    )
    input_: capo_dynamodb.types.restore_table_to_point_in_time_input.RestoreTableToPointInTimeInput = {
        "target_table_name": target_table_name
    }
    if source_table_arn is not None:
        input_["source_table_arn"] = source_table_arn
    if source_table_name is not None:
        input_["source_table_name"] = source_table_name
    if use_latest_restorable_time is not None:
        input_["use_latest_restorable_time"] = use_latest_restorable_time
    if restore_date_time is not None:
        input_["restore_date_time"] = restore_date_time
    if billing_mode_override is not None:
        input_["billing_mode_override"] = billing_mode_override
    if global_secondary_index_override is not None:
        input_["global_secondary_index_override"] = global_secondary_index_override
    if local_secondary_index_override is not None:
        input_["local_secondary_index_override"] = local_secondary_index_override
    if provisioned_throughput_override is not None:
        input_["provisioned_throughput_override"] = provisioned_throughput_override
    if on_demand_throughput_override is not None:
        input_["on_demand_throughput_override"] = on_demand_throughput_override
    if sse_specification_override is not None:
        input_["sse_specification_override"] = sse_specification_override
    if vector_index_override is not None:
        input_["vector_index_override"] = vector_index_override

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output