Tablestore supports conditional updates, which allow you to update data in a target row only if the row meets a specified condition.
Function overview
Conditional updates allow you to implement mechanisms similar to the SQL WHERE clause or optimistic locking. In Tablestore, conditional updates can be based on row existence or column values.
Row existence condition
This condition checks whether a target row exists in the data table. The following three conditions are supported:
Ignore: The existence of the row is not checked.
Expect existence: The condition is met if the target row exists in the data table.
Expect non-existence: The condition is met if the target row does not exist in the data table.
Column value condition
This condition checks whether the value of an attribute column in the target row meets a specified condition. The following two types of conditions are supported.
Type | Supported operations | Description |
Single-value condition | Relational operations: equal to, not equal to, greater than, greater than or equal to, less than, and less than or equal to |
|
Composite condition | Logical operations: NOT, AND, and OR |
|
Usage
Conditional updates can be performed only using an SDK or the command line interface (CLI).
Billing
When you use conditional updates to check for row existence and column values, the target row data is read. This operation incurs data read fees. The fees are calculated in the same way as for standard data reads. For more information, see Billing overview.