Skip to content

restore_table_from_snapshot async

restore_table_from_snapshot(
    namespace_name: str,
    workgroup_name: str,
    snapshot_name: str,
    source_database_name: str,
    source_table_name: str,
    new_table_name: str,
    *,
    config_overrides: Optional[AsyncRedshiftServerlessClientConfig] = None,
    source_schema_name: Optional[str] = None,
    target_database_name: Optional[str] = None,
    target_schema_name: Optional[str] = None,
    activate_case_sensitive_identifier: Optional[bool] = None,
) -> RestoreTableFromSnapshotResponse

Restores a table from a snapshot to your Amazon Redshift Serverless instance. You can't use this operation to restore tables with interleaved sort keys.

Parameters:

  • namespace_name (str) –

    The namespace of the snapshot to restore from.

  • workgroup_name (str) –

    The workgroup to restore the table to.

  • snapshot_name (str) –

    The name of the snapshot to restore the table from.

  • source_database_name (str) –

    The name of the source database that contains the table being restored.

  • source_schema_name (Optional[str], default: None ) –

    The name of the source schema that contains the table being restored.

  • source_table_name (str) –

    The name of the source table being restored.

  • target_database_name (Optional[str], default: None ) –

    The name of the database to restore the table to.

  • target_schema_name (Optional[str], default: None ) –

    The name of the schema to restore the table to.

  • new_table_name (str) –

    The name of the table to create from the restore operation.

  • activate_case_sensitive_identifier (Optional[bool], default: None ) –

    Indicates whether name identifiers for database, schema, and table are case sensitive. If true, the names are case sensitive. If false, the names are not case sensitive. The default is false.

Raises:

Source code in docs_src/capo_redshift_serverless/_services/async_redshift_serverless.py
async def restore_table_from_snapshot(
    self,
    namespace_name: str,
    workgroup_name: str,
    snapshot_name: str,
    source_database_name: str,
    source_table_name: str,
    new_table_name: str,
    *,
    config_overrides: Optional[AsyncRedshiftServerlessClientConfig] = None,
    source_schema_name: Optional[str] = None,
    target_database_name: Optional[str] = None,
    target_schema_name: Optional[str] = None,
    activate_case_sensitive_identifier: Optional[bool] = None,
) -> "capo_redshift_serverless.types.restore_table_from_snapshot_response.RestoreTableFromSnapshotResponse":
    """<p>Restores a table from a snapshot to your Amazon Redshift Serverless instance. You can't use this operation to restore tables with <a href="https://docs.aws.amazon.com/redshift/latest/dg/t_Sorting_data.html#t_Sorting_data-interleaved">interleaved sort keys</a>.</p>

    Args:
        namespace_name: <p>The namespace of the snapshot to restore from.</p>
        workgroup_name: <p>The workgroup to restore the table to.</p>
        snapshot_name: <p>The name of the snapshot to restore the table from.</p>
        source_database_name: <p>The name of the source database that contains the table being restored.</p>
        source_schema_name: <p>The name of the source schema that contains the table being restored.</p>
        source_table_name: <p>The name of the source table being restored.</p>
        target_database_name: <p>The name of the database to restore the table to.</p>
        target_schema_name: <p>The name of the schema to restore the table to.</p>
        new_table_name: <p>The name of the table to create from the restore operation.</p>
        activate_case_sensitive_identifier: <p>Indicates whether name identifiers for database, schema, and table are case sensitive. If true, the names are case sensitive. If false, the names are not case sensitive. The default is false.</p>

    Raises:
        capo_redshift_serverless.errors.conflict_exception.ConflictException: <p>The submitted action has conflicts.</p>
        capo_redshift_serverless.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_redshift_serverless.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_redshift_serverless.errors.validation_exception.ValidationException: <p>The input failed to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_redshift_serverless.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_redshift_serverless.types.restore_table_from_snapshot_request.RestoreTableFromSnapshotRequest]",
    ) -> AsyncOperationResponse[
        "capo_redshift_serverless.types.restore_table_from_snapshot_response.RestoreTableFromSnapshotResponse"
    ]:
        import capo_redshift_serverless._operations.redshift_serverless.restore_table_from_snapshot

        (
            output,
            http_response,
        ) = await capo_redshift_serverless._operations.redshift_serverless.restore_table_from_snapshot.async_restore_table_from_snapshot(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RestoreTableFromSnapshot")
    )
    input_: capo_redshift_serverless.types.restore_table_from_snapshot_request.RestoreTableFromSnapshotRequest = {
        "namespace_name": namespace_name,
        "workgroup_name": workgroup_name,
        "snapshot_name": snapshot_name,
        "source_database_name": source_database_name,
        "source_table_name": source_table_name,
        "new_table_name": new_table_name,
    }
    if source_schema_name is not None:
        input_["source_schema_name"] = source_schema_name
    if target_database_name is not None:
        input_["target_database_name"] = target_database_name
    if target_schema_name is not None:
        input_["target_schema_name"] = target_schema_name
    if activate_case_sensitive_identifier is not None:
        input_["activate_case_sensitive_identifier"] = (
            activate_case_sensitive_identifier
        )

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