Skip to content

import_table async

import_table(
    s3_bucket_source: S3BucketSource,
    input_format: InputFormat,
    table_creation_parameters: TableCreationParameters,
    *,
    config_overrides: Optional[AsyncDynamoDBClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    input_format_options: Optional[InputFormatOptions] = None,
    input_compression_type: Optional[InputCompressionType] = None,
) -> ImportTableOutput

Imports table data from an S3 bucket.

Parameters:

  • client_token (Optional[ClientToken], default: None ) –

    Providing a ClientToken makes the call to ImportTableInput idempotent, meaning that multiple identical calls have the same effect as one single call.

    A client token is valid for 8 hours after the first request that uses it is completed. After 8 hours, any request with the same client token is treated as a new request. Do not resubmit the same request with the same client token for more than 8 hours, or the result might not be idempotent.

    If you submit a request with the same client token but a change in other parameters within the 8-hour idempotency window, DynamoDB returns an IdempotentParameterMismatch exception.

  • s3_bucket_source (S3BucketSource) –

    The S3 bucket that provides the source for the import.

  • input_format (InputFormat) –

    The format of the source data. Valid values for ImportFormat are CSV, DYNAMODB_JSON or ION.

  • input_format_options (Optional[InputFormatOptions], default: None ) –

    Additional properties that specify how the input is formatted,

  • input_compression_type (Optional[InputCompressionType], default: None ) –

    Type of compression to be used on the input coming from the imported table.

  • table_creation_parameters (TableCreationParameters) –

    Parameters for the table to import the data into.

Raises:

  • ImportConflictException –

    There was a conflict when importing from the specified S3 source. This can occur when the current import conflicts with a previous import request that had the same client token.

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

  • ResourceInUseException –

    The operation conflicts with the resource's availability. For example:

    • You attempted to recreate an existing table.

    • You tried to delete a table currently in the CREATING state.

    • You tried to update a resource that was already being updated.

    When appropriate, wait for the ongoing update to complete and attempt the request again.

  • UnknownServiceError –

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

Source code in docs_src/capo_dynamodb/_services/async_dynamo_db.py
async def import_table(
    self,
    s3_bucket_source: "capo_dynamodb.types.s3_bucket_source.S3BucketSource",
    input_format: "capo_dynamodb.types.input_format.InputFormat",
    table_creation_parameters: "capo_dynamodb.types.table_creation_parameters.TableCreationParameters",
    *,
    config_overrides: Optional[AsyncDynamoDBClientConfig] = None,
    client_token: Optional["capo_dynamodb.types.client_token.ClientToken"] = None,
    input_format_options: Optional[
        "capo_dynamodb.types.input_format_options.InputFormatOptions"
    ] = None,
    input_compression_type: Optional[
        "capo_dynamodb.types.input_compression_type.InputCompressionType"
    ] = None,
) -> "capo_dynamodb.types.import_table_output.ImportTableOutput":
    """<p> Imports table data from an S3 bucket. </p>

    Args:
        client_token: <p>Providing a <code>ClientToken</code> makes the call to <code>ImportTableInput</code> idempotent, meaning that multiple identical calls have the same effect as one single call.</p> <p>A client token is valid for 8 hours after the first request that uses it is completed. After 8 hours, any request with the same client token is treated as a new request. Do not resubmit the same request with the same client token for more than 8 hours, or the result might not be idempotent.</p> <p>If you submit a request with the same client token but a change in other parameters within the 8-hour idempotency window, DynamoDB returns an <code>IdempotentParameterMismatch</code> exception.</p>
        s3_bucket_source: <p> The S3 bucket that provides the source for the import. </p>
        input_format: <p> The format of the source data. Valid values for <code>ImportFormat</code> are <code>CSV</code>, <code>DYNAMODB_JSON</code> or <code>ION</code>. </p>
        input_format_options: <p> Additional properties that specify how the input is formatted, </p>
        input_compression_type: <p> Type of compression to be used on the input coming from the imported table. </p>
        table_creation_parameters: <p>Parameters for the table to import the data into. </p>

    Raises:
        capo_dynamodb.errors.import_conflict_exception.ImportConflictException: <p> There was a conflict when importing from the specified S3 source. This can occur when the current import conflicts with a previous import request that had the same client token. </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.resource_in_use_exception.ResourceInUseException: <p>The operation conflicts with the resource's availability. For example:</p> <ul> <li> <p>You attempted to recreate an existing table.</p> </li> <li> <p>You tried to delete a table currently in the <code>CREATING</code> state.</p> </li> <li> <p>You tried to update a resource that was already being updated.</p> </li> </ul> <p>When appropriate, wait for the ongoing update to complete and attempt the request again.</p>
        capo_dynamodb.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_dynamodb.types.import_table_input.ImportTableInput]",
    ) -> AsyncOperationResponse[
        "capo_dynamodb.types.import_table_output.ImportTableOutput"
    ]:
        import capo_dynamodb._operations.dynamo_db_20120810.import_table

        (
            output,
            http_response,
        ) = await capo_dynamodb._operations.dynamo_db_20120810.import_table.async_import_table(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ImportTable")
    )
    input_: capo_dynamodb.types.import_table_input.ImportTableInput = {
        "s3_bucket_source": s3_bucket_source,
        "input_format": input_format,
        "table_creation_parameters": table_creation_parameters,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if input_format_options is not None:
        input_["input_format_options"] = input_format_options
    if input_compression_type is not None:
        input_["input_compression_type"] = input_compression_type

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