You can call this operation to delete a row of data.
Request structure
message DeleteRowRequest {
required string table_name = 1;
required bytes primary_key = 2; // The Plainbuffer encoding is binary.
required Condition condition = 3;
optional ReturnContent return_content = 4;
}
Parameter | Type | Required | Description |
---|---|---|---|
table_name | string | Yes | The name of the table whose data is to be updated. |
primary_key | bytes | Yes | The primary key of the row to be deleted, which is in Plainbuffer format. For more information about encoding, see Plainbuffer encoding. |
condition | Condition | Yes |
|
return_content | ReturnContent | No | The data type after the row is successfully written. Only the primary key can be returned, which is used for the auto-increment function of the primary key column. |
Response structure
message DeleteRowResponse {
required ConsumedCapacity consumed = 1;
optional bytes row = 2;
}
Parameter | Type | Description |
---|---|---|
consumed | ConsumedCapacity | The number of capacity units (CUs) consumed by this operation. |
row | bytes |
|
CU consumption:
-
If the row does not exist:
-
If the value of the condition parameter is IGNORE, the number of consumed write CUs is calculated based on the formula: Number of consumed write CUs = (Size of primary key columns in the row/4 KB) rounded up.
-
If the value of the condition parameter is EXPECT_EXIST, the row fails to be deleted, and one write CU and one read CU are consumed
-
-
If the row exists:
-
If the value of the condition parameter is IGNORE, the number of consumed write CUs is calculated based on the formula: Number of consumed write CUs = (Size of primary key columns in the row/4 KB) rounded up.
-
If the value of the condition parameter is EXPECT_EXIST, both write and read CUs are consumed. The number of consumed write CUs and the number of consumed read CUs are calculated based on the formula: Number of consumed read/write CUs = (Size of primary key columns in the row/4 KB) rounded up.
For more information about how to calculate the data size, see Billing.
-
-
If an internal error code is returned (HTTP status code: 5XX), this operation does not consume CUs. If other errors are returned, one write CU is consumed.
-
If the request times out and the results are undefined, CUs may or may not be consumed.