You can call this operation to simultaneously insert, modify, or delete multiple rows of data in one or more tables.
It is a set of multiple PutRow, UpdateRow, and DeleteRow operations. The execution, returning of results, and capacity unit (CU) consumption of each individual operation are carried out independently.
Compared with the execution of a large number of write operations, the use of BatchWriteRow can reduce the request response time and increase the data write rate.
Request structure
message BatchWriteRowRequest {
repeated TableInBatchWriteRowRequest tables = 1;
}
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
tables | repeated TableInBatchWriteRowRequest | Yes |
This parameter specifies the information of rows that require write operations. An error is returned if any of the following conditions occurs:
|
Response structure
message BatchWriteRowResponse {
repeated TableInBatchWriteRowResponse tables = 1;
}
Response parameters
Parameter | Type | Description |
---|---|---|
tables | TableInBatchWriteRowResponse |
This parameter specifies the response information corresponding to the operations for each table. The response information contains the execution results, error codes, and number of CUs consumed. The TableInBatchWriteRowResponse object order in the response message is the same as the TableInBatchWriteRowRequest object order in BatchWriteRowRequest. The RowInBatchWriteRowResponse object orders contained in put_rows, update_rows, and delete_rows in each TableInBatchWriteRowRequest are the same as the respective PutRowInBatchWriteRowRequest, UpdateRowInBatchWriteRowRequest, and DeleteRowInBatchWriteRowRequest object orders contained in put_rows, update_rows, and delete_rows in TableInBatchWriteRowRequest. If a row fails to be read, the is_ok value of the row in RowInBatchWriteRowResponse is false. |
CU consumption
- If the entire operation fails, it does not consume any CUs.
- If the request times out and the results are undefined, CUs may or may not be consumed.
- In other situations, each PutRowInBatchWriteRowRequest, UpdateRowInBatchWriteRowRequestDelete, and RowInBatchWriteRowRequest operation corresponds to a separate write operation when the number of write capacity units are counted. For more information, see PutRow, UpdateRow, and DeleteRow.