batchExecuteStatement method

Future<BatchExecuteStatementOutput> batchExecuteStatement({
  1. required List<BatchStatementRequest> statements,
  2. ReturnConsumedCapacity? returnConsumedCapacity,
})

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 .

May throw InternalServerError. May throw RequestLimitExceeded. May throw ThrottlingException.

Parameter statements : The list of PartiQL statements representing the batch to run.

Implementation

Future<BatchExecuteStatementOutput> batchExecuteStatement({
  required List<BatchStatementRequest> statements,
  ReturnConsumedCapacity? returnConsumedCapacity,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'DynamoDB_20120810.BatchExecuteStatement'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Statements': statements,
      if (returnConsumedCapacity != null)
        'ReturnConsumedCapacity': returnConsumedCapacity.value,
    },
  );

  return BatchExecuteStatementOutput.fromJson(jsonResponse.body);
}