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
  • This parameter determines whether to perform existence check before data is updated. You can set this parameter to one of the following values:

    • IGNORE: the row existence check is not performed.

    • EXPECT_EXIST: the row is expected to exist.

  • If this row is expected to exist but does not, the delete operation fails and an error is returned. If the existence of the row is ignored, this operation succeeds regardless of the row existence.

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
  • The returned data when return_content is set.
  • If return_content is not set or no value is returned, NULL is returned.
  • This parameter is in the Plainbuffer format. For more information about encoding, see Plainbuffer encoding.

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.