Writes multiple rows of data at the same time. You can call this operation to insert, modify, or delete a row of data.
Request syntax
message BulkImportRequest {
required string table_name = 1;
repeated RowInBulkImportRequest rows = 2;
}
Parameter | Type | Required | Description |
table_name | string | Yes | The name of the data table. |
rows | repeated RowInBulkImportRequest | Yes | The row of data that you want to manage. |
Response syntax
message BulkImportResponse {
required string table_name = 1;
repeated RowInBulkImportResponse rows = 2;
}
Parameter | Type | Required | Description |
table_name | string | Yes | The name of the data table. |
rows | repeated RowInBulkImportResponse | Yes | Indicates whether the write operation is successful, the error message, and the consumed capacity units (CUs). For more information, see Read and write throughput. |
Use Tablestore SDKs
Tablestore SDK for Java: Batch write data offline
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.
If an internal error occurs and the HTTP status code 5xx is returned, the operation does not consume CUs. If other errors occur, one CU is consumed.
In other cases, RowInBulkImportRequest specifies the insert, update and delete operations, and the consumed CU is independently calculated based on the operation that is performed. The following content describes the calculation methods of CUs consumed by performing the insert, update, and delete operations on rows of data.
When you insert a row of data, the number of consumed write CUs is rounded up from the value calculated based on the following formula: (Size of the data in all primary key columns of the row + Size of the data in the inserted attribute columns)/4 KB.
When you update a row of data, the number of consumed write CUs is rounded up from the value calculated based on the following formula: (Size of the data in all primary key columns of the row + Size of the data in the updated attribute columns)/4 KB. If you want to delete an attribute column when you update a row of data, only the column name length is included in the data size of the attribute column.
When you delete a row of data, the number of consumed write CUs is rounded up from the value calculated based on the following formula: Size of the data in all primary key columns of the row/4 KB.
For more information about how to calculate the data size, see Storage usage.