Deletes a row of data.
Request syntax
message DeleteRowRequest {
required string table_name = 1;
required bytes primary_key = 2; // The data is encoded as binary data in the PlainBuffer format.
required Condition condition = 3;
optional ReturnContent return_content = 4;
}
Parameter | Type | Required | Description |
---|---|---|---|
table_name | string | Yes | The name of the data table. |
primary_key | bytes | Yes | The primary key of the row that you want to delete.
The primary key is encoded in the PlainBuffer format. For more information about PlainBuffer, see PlainBuffer. |
condition | Condition | Yes | Specifies whether to check the existence of the row before data is deleted. Default
value: IGNORE. Valid values:
|
return_content | ReturnContent | No | The type of data to return. Only the primary key can be returned. In most cases, this parameter is used by the auto-increment primary key column feature. |
Response syntax
message DeleteRowResponse {
required ConsumedCapacity consumed = 1;
optional bytes row = 2;
}
Parameter | Type | Description |
---|---|---|
consumed | ConsumedCapacity | The number of capacity units (CUs) consumed by the operation. For more information, see CU consumption. |
row | bytes | The data that is returned when return_content is specified. If return_content is not
specified or no return value exists, NULL is returned.
The returned data is encoded in the PlainBuffer format. For more information about PlainBuffer, see PlainBuffer. |
Use Tablestore SDKs
You can use the following Tablestore SDKs to delete a row of data:
CU consumption
- If the row that you want to delete does not exist, the number of consumed CUs varies
based on the value that you specified for the condition parameter.
- If the value of the condition parameter is IGNORE, the number of consumed write CUs is rounded up from the value that is calculated by using the following formula: Number of consumed write CUs = Size of data in all primary key columns of the row/4 KB.
- If the value of the condition parameter is EXPECT_EXIST, the row fails to be deleted. One write CU and one read CU are consumed.
- If the row that you want to delete exists, the number of consumed CUs varies based
on the value that you specified for the condition parameter.
- If the value of the condition parameter is IGNORE, the number of consumed write CUs is rounded up from the value that is calculated by using the following formula: Number of consumed write CUs = Size of data in all primary key columns of the row/4 KB.
- If the value of the condition parameter is EXPECT_EXIST, both write and read CUs are consumed. The number of consumed write CUs is rounded up from the value that is calculated by using the following formula: Number of consumed write CUs = Size of data in all primary key columns of the row/4 KB. The number of consumed read CUs is rounded up from the value that is calculated by using the following formula: Number of consumed read CUs = Size of data in all primary key columns of the row/4 KB.
For more information about how to calculate the data size, see Billing overview.
- If the request times out and the results are undefined, CUs may or may not be consumed.
- If an HTTP status code 5xx is returned, which indicates that an internal error occurred, the operation does not consume CUs. If other errors are returned, one read CU is consumed.