Skip to content

batch_execute_statement async

batch_execute_statement(
    statements: PartiQLBatchRequest,
    *,
    config_overrides: Optional[AsyncDynamoDBClientConfig] = None,
    return_consumed_capacity: Optional[ReturnConsumedCapacity] = None,
) -> BatchExecuteStatementOutput

This operation allows you to perform batch reads or writes on data stored in DynamoDB, using PartiQL. Each read statement in a BatchExecuteStatement must specify an equality condition on all key attributes. This enforces that each SELECT statement in a batch returns at most a single item. For more information, see Running batch operations with PartiQL for DynamoDB .

The entire batch must consist of either read statements or write statements, you cannot mix both in one batch.

A HTTP 200 response does not mean that all statements in the BatchExecuteStatement succeeded. Error details for individual statements can be found under the Error field of the BatchStatementResponse for each statement.

Parameters:

  • statements (PartiQLBatchRequest) –

    The list of PartiQL statements representing the batch to run.

Raises:

  • InternalServerError –

    An error occurred on the server side.

  • RequestLimitExceeded –

    Throughput exceeds the current throughput quota for your account. For detailed information about why the request was throttled and the ARN of the impacted resource, find the ThrottlingReason field in the returned exception. Contact Amazon Web Services Support to request a quota increase.

  • ThrottlingException –

    The request was denied due to request throttling. For detailed information about why the request was throttled and the ARN of the impacted resource, find the ThrottlingReason field in the returned exception.

  • 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 batch_execute_statement(
    self,
    statements: "capo_dynamodb.types.parti_ql_batch_request.PartiQLBatchRequest",
    *,
    config_overrides: Optional[AsyncDynamoDBClientConfig] = None,
    return_consumed_capacity: Optional[
        "capo_dynamodb.types.return_consumed_capacity.ReturnConsumedCapacity"
    ] = None,
) -> (
    "capo_dynamodb.types.batch_execute_statement_output.BatchExecuteStatementOutput"
):
    """<p>This operation allows you to perform batch reads or writes on data stored in DynamoDB, using PartiQL. Each read statement in a <code>BatchExecuteStatement</code> must specify an equality condition on all key attributes. This enforces that each <code>SELECT</code> statement in a batch returns at most a single item. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ql-reference.multiplestatements.batching.html">Running batch operations with PartiQL for DynamoDB </a>.</p> <note> <p>The entire batch must consist of either read statements or write statements, you cannot mix both in one batch.</p> </note> <important> <p>A HTTP 200 response does not mean that all statements in the BatchExecuteStatement succeeded. Error details for individual statements can be found under the <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchStatementResponse.html#DDB-Type-BatchStatementResponse-Error">Error</a> field of the <code>BatchStatementResponse</code> for each statement.</p> </important>

    Args:
        statements: <p>The list of PartiQL statements representing the batch to run.</p>

    Raises:
        capo_dynamodb.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
        capo_dynamodb.errors.request_limit_exceeded.RequestLimitExceeded: <p>Throughput exceeds the current throughput quota for your account. For detailed information about why the request was throttled and the ARN of the impacted resource, find the <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html">ThrottlingReason</a> field in the returned exception. Contact <a href="https://aws.amazon.com/support">Amazon Web Services Support</a> to request a quota increase.</p>
        capo_dynamodb.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. For detailed information about why the request was throttled and the ARN of the impacted resource, find the <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ThrottlingReason.html">ThrottlingReason</a> field in the returned exception.</p>
        capo_dynamodb.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_dynamodb.types.batch_execute_statement_input.BatchExecuteStatementInput]",
    ) -> AsyncOperationResponse[
        "capo_dynamodb.types.batch_execute_statement_output.BatchExecuteStatementOutput"
    ]:
        import capo_dynamodb._operations.dynamo_db_20120810.batch_execute_statement

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("BatchExecuteStatement")
    )
    input_: capo_dynamodb.types.batch_execute_statement_input.BatchExecuteStatementInput = {
        "statements": statements
    }
    if return_consumed_capacity is not None:
        input_["return_consumed_capacity"] = return_consumed_capacity

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