Inserts, modifies, or deletes multiple rows of data from one or more tables at the same time.
The BatchWriteRow operation is a set of PutRow, UpdateRow, or DeleteRow operations. If you call the BatchWriteRow operation, each PutRow, UpdateRow, or DeleteRow operation is separately performed, the response to each PutRow, UpdateRow, or DeleteRow operation is separately returned, and consumption units (CUs) are separately calculated for each PutRow, UpdateRow, or DeleteRow operation.
If you call the BacthWriteRow operation instead of calling the PutRow, UpdateRow, or DeleteRow operation multiple times, the response time is reduced, and the data write performance is improved.
Request syntax
message BatchWriteRowRequest {
repeated TableInBatchWriteRowRequest tables = 1;
}
Parameter | Type | Required | Description |
---|---|---|---|
tables | TableInBatchWriteRowRequest | Yes | The rows on which you want to perform the batch write operation.
If one of the following conditions is met, an error is returned:
|
Response syntax
message BatchWriteRowResponse {
repeated TableInBatchWriteRowResponse tables = 1;
}
Parameter | Type | Description |
---|---|---|
tables | TableInBatchWriteRowResponse | The response to each operation for each table. The response contains the execution
results, error codes, and the number of consumed CUs.
The order of the TableInBatchWriteRowResponse methods in the response is the same as the order of the TableInBatchWriteRowRequest methods in BatchWriteRowRequest. The order of the RowInBatchWriteRowResponse methods that are contained in put_rows, update_rows, or delete_rows in each TableInBatchWriteRowRequest method is the same as the order of the PutRowInBatchWriteRowRequest, UpdateRowInBatchWriteRowRequest, or DeleteRowInBatchWriteRowRequest methods that are contained in put_rows, update_rows, or delete_rows in TableInBatchWriteRowRequest. If a row fails to be read, the value of is_ok in RowInBatchWriteRowResponse is false for the row. |
Use Tablestore SDKs
You can use the following Tablestore SDKs to insert, modify, or delete multiple rows of data from one or more tables at the same time:
- Tablestore SDK for Java: BatchWriteRow
- Tablestore SDK for Go: BatchWriteRow
- Tablestore SDK for Python: BatchWriteRow
- Tablestore SDK for Node.js: BatchWriteRow
- Tablestore SDK for .NET: BatchWriteRow
- Tablestore SDK for PHP: BatchWriteRow
CU consumption
- If the operation fails, no CUs are consumed.
- If the request times out and the results are undefined, CUs may or may not be consumed.
- In other scenarios, each PutRowInBatchWriteRowRequest, UpdateRowInBatchWriteRowRequest, or DeleteRowInBatchWriteRowRequest method is considered a PutRow, UpdateRow, or DeleteRow operation for which CUs are separately calculated. For more information, see PutRow, UpdateRow, and DeleteRow.