DeleteRow

Last Updated: Sep 07, 2017

Action:

This API deletes a data row.

Request message structure:

  1. message DeleteRowRequest {
  2. required string table_name = 1;
  3. required bytes primary_key = 2; // The Plainbuffer encoding is binary
  4. required Condition condition = 3;
  5. optional ReturnContent return_content = 4;
  6. }

table_name:

  • Type: String

  • Required parameter: Yes

  • The name of the table whose data is to be updated.

primary_key

  • Type: Bytes

  • Required parameter: Yes

  • The primary key of the row to be deleted, which is in Plainbuffer format. For details about encoding, see Plainbuffer encoding.

condition:

  • Type: Condition

  • Required parameter: Yes

  • Determines whether to perform existence check before data updating. There are two values:

    • IGNORE: indicates that the row existence check is not performed.

    • EXPECT_EXIST: indicates that the row is expected to exist.

  • If this row is expected to exist but does not, the delete operation will fail and an error will be returned. If the existence of the row is ignored, this operation is successful regardless of the table existence.

return_content:

  • Type: ReturnContent

  • Required parameter: No

  • The data type after the row is successfully written. Currently, only the primary key can be returned, which is used for the auto-increment function of the primary key column.

Response message structure:

  1. message DeleteRowResponse {
  2. required ConsumedCapacity consumed = 1;
  3. optional bytes row = 2;
  4. }

consumed:

Capacity unit consumption:

  • If this row does not exist:

    • If the value of the specified condition check is IGNORE, the number of consumed write capacity units is the size of the primary key of the row divided by 4 KB and rounded up.

    • If the value of the specified condition check is EXPECT_EXIST, deletion of the row will fail, and one write capacity unit and one read capacity unit will be consumed.

  • If this row exists:

    • If the value of the specified condition check is IGNORE, the number of consumed write capacity units is the size of the primary key of the row divided by 4 KB and rounded up.

    • If the value of the specified condition check is EXPECT_EXIST, both write capacity units and read capacity units are consumed. The number of consumed write capacity units and the number of consumed read capacity units are the size of the primary key of the row divided by 4 KB and rounded up, respectively.

      For details about how to calculate the data size, see Billing.

  • If an internal error code is returned (HTTP status code: 5XX), this operation will not consume capacity units. If other errors are returned, one write capacity unit will be consumed.

  • If the request times out and the results are undefined, a capacity unit may or may not be consumed.

row:

  • Type: bytes

  • The returned data when return_content is set.

  • If return_content is not set or there is no returned value, NULL is returned.

  • It is in Plainbuffer format. For details about encoding, see Plainbuffer encoding.

Thank you! We've received your feedback.