class Aws::DynamoDB::Types::UpdateItemInput
@see docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/UpdateItemInput AWS API Documentation
@return [String]
receiving a larger response. No read capacity units are consumed.
value aside from the small network and processing overhead of
There is no additional cost associated with requesting a return
`UpdateItem` operation that failed a condition check.
An optional parameter that returns the item attributes for an
@!attribute [rw] return_values_on_condition_check_failure
@return [Hash<String,Types::AttributeValue>]<br>: docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html<br><br><br><br>Expressions][1] in the *Amazon DynamoDB Developer Guide*.
For more information on expression attribute values, see [Condition
`ProductStatus IN (:avail, :back, :disc)‘
You could then use these values in an expression, such as this:
“:disc”:{“S”:“Discontinued”} }`
`{ “:avail”:{“S”:“Available”}, “:back”:{“S”:“Backordered”},
follows:
You would first need to specify `ExpressionAttributeValues` as
`Available | Backordered | Discontinued`
following:
whether the value of the `ProductStatus` attribute was one of the
attribute value. For example, suppose that you wanted to check
Use the : (colon) character in an expression to dereference an
One or more values that can be substituted in an expression.
@!attribute [rw] expression_attribute_values
@return [Hash<String,String>]<br>: docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html<br>[1]: docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html<br><br><br><br>Guide*.
[Specifying Item Attributes] in the *Amazon DynamoDB Developer
For more information about expression attribute names, see
</note>
runtime.
attribute values*, which are placeholders for the actual value at
<note markdown=“1”> Tokens that begin with the : character are *expression
^
* `#P = :val`
example:
You could then use this substitution in an expression, as in this
^
* `{“#P”:“Percentile”}`
following for `ExpressionAttributeNames`:
Developer Guide*.) To work around this, you could specify the
reserved words, see [Reserved Words] in the *Amazon DynamoDB
cannot be used directly in an expression. (For the complete list of
The name of this attribute conflicts with a reserved word, so it
^
* `Percentile`
name. For example, consider the following attribute name:
Use the **#** character in an expression to dereference an attribute
misinterpreted in an expression.
* To prevent special characters in an attribute name from being
name in an expression.
* To create a placeholder for repeating occurrences of an attribute
reserved word.
* To access an attribute whose name conflicts with a DynamoDB
`ExpressionAttributeNames`:
expression. The following are some use cases for using
One or more substitution tokens for attribute names in an
@!attribute [rw] expression_attribute_names
@return [String]<br>: docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html<br><br><br><br>Conditions][1] in the *Amazon DynamoDB Developer Guide*.
For more information about condition expressions, see [Specifying
* Logical operators: `AND | OR | NOT`
* Comparison operators: `= | <> | < | > | <= | >= | BETWEEN | IN `
These function names are case-sensitive.
attribute_type | contains | begins_with | size`
* Functions: `attribute_exists | attribute_not_exists |
An expression can contain any of the following:
to succeed.
A condition that must be satisfied in order for a conditional update
@!attribute [rw] condition_expression
@return [String]<br>: docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Modifying.html<br><br><br><br>Attributes][1] in the *Amazon DynamoDB Developer Guide*.
For more information on update expressions, see [Modifying Items and
:value5`
following: `SET a=:value1, b=:value2 DELETE :value3, :value4,
You can have many actions in a single expression, such as the
attributes.
`DELETE` can only be used on top-level attributes, not nested
The `DELETE` action only supports set data types. In addition,
error.
final attribute value is `[b]`. Specifying an empty set is an<br>`` and the `DELETE` action specifies `[a,c]`, then the
from the old set. For example, if the attribute value was the set
If a set of values is specified, then those values are subtracted
* `DELETE` - Deletes an element from a set.
nested attributes.
addition, `ADD` can only be used on top-level attributes, not
The `ADD` action only supports Number and set data types. In
also be a set of strings.
if the existing data type is a set of strings, the `Value` must
Both sets must have the same primitive data type. For example,
type.
and the attribute type specified does not match the existing set
error occurs if an `ADD` action is specified for a set attribute
specified `[3]`, then the final attribute value is `[1,2,3]`. An
attribute value is the set `[1,2]`, and the `ADD` action
then `Value` is added to the existing set. For example, if the
* If the existing data type is a set and if `Value` is also a set,
</note>
the item, with a value of `3`.
add `3` to it. The result will be a new `itemcount` attribute in
`itemcount` attribute, set its initial value to `0`, and finally
`3` to this attribute anyway. DynamoDB will create the
attribute named `itemcount`, but you decide to `ADD` the number
suppose that the item you want to update doesn’t have an
update, DynamoDB uses ‘0` as the initial value. For example,
decrement an attribute value that doesn’t exist before the
Similarly, if you use ‘ADD` for an existing item to increment or
the initial value.
item that doesn’t exist before the update, DynamoDB uses ‘0` as
<note markdown=“1”> If you use `ADD` to increment or decrement a number value for an
subtracted from the existing attribute.
attribute. If `Value` is a negative number, then it is
number, then `Value` is mathematically added to the existing
* If the existing attribute is a number, and if `Value` is also a
behavior of `ADD` depends on the data type of the attribute:
does not already exist. If the attribute does exist, then the
* `ADD` - Adds the specified value to the item, if the attribute
* `REMOVE` - Removes one or more attributes from an item.
These function names are case-sensitive.
operands.
start or the end of the list by reversing the order of the
new element added to it. You can append the new element to the
* `list_append (operand, operand)` - evaluates to a list with a
already be present in the item.
use this function to avoid overwriting an attribute that may
evaluates to operand; otherwise, it evaluates to path. You can
an attribute at the specified path, then `if_not_exists`
* `if_not_exists (path, operand)` - if the item does not contain
`SET` supports the following functions:
+ :val`
attribute that is of type Number. For example: `SET myNum = myNum
values. You can also use `SET` to add or subtract from an
of these attributes already exist, they are replaced by the new
* `SET` - Adds one or more attributes and values to an item. If any
The following action values are available for `UpdateExpression`.
action to be performed on them, and new values for them.
An expression that defines one or more attributes to be updated, the
@!attribute [rw] update_expression
@return [String]
returned.
response. If set to `NONE` (the default), no statistics are
any, that were modified during the operation are returned in the
`SIZE`, the response includes statistics about item collections, if
Determines whether item collection metrics are returned. If set to
@!attribute [rw] return_item_collection_metrics
@return [String]
response.
* `NONE` - No `ConsumedCapacity` details are included in the
`ConsumedCapacity` for the operation.
* `TOTAL` - The response includes only the aggregate
table(s).
`INDEXES` will only return `ConsumedCapacity` information for
do not access any indexes at all. In these cases, specifying
Note that some operations, such as `GetItem` and `BatchGetItem`,
and secondary index that was accessed.
for the operation, together with `ConsumedCapacity` for each table
* `INDEXES` - The response includes the aggregate `ConsumedCapacity`
throughput consumption that is returned in the response:
Determines the level of detail about either provisioned or on-demand
@!attribute [rw] return_consumed_capacity
@return [String]
The values returned are strongly consistent.
receiving a larger response. No read capacity units are consumed.
value aside from the small network and processing overhead of
There is no additional cost associated with requesting a return
appear after the UpdateItem operation.
* `UPDATED_NEW` - Returns only the updated attributes, as they
appear after the UpdateItem operation.
* `ALL_NEW` - Returns all of the attributes of the item, as they
appeared before the UpdateItem operation.
* `UPDATED_OLD` - Returns only the updated attributes, as they
appeared before the UpdateItem operation.
* `ALL_OLD` - Returns all of the attributes of the item, as they
`ReturnValues`.)
`NONE`, then nothing is returned. (This setting is the default for
* `NONE` - If `ReturnValues` is not specified, or if its value is
`UpdateItem`, the valid values are:
appear before or after they are successfully updated. For
Use `ReturnValues` if you want to get the item attributes as they
@!attribute [rw] return_values
@return [String]<br>: docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.ConditionalOperator.html<br><br><br><br>DynamoDB Developer Guide*.
more information, see [ConditionalOperator] in the *Amazon
This is a legacy parameter. Use `ConditionExpression` instead. For
@!attribute [rw] conditional_operator
@return [Hash<String,Types::ExpectedAttributeValue>]<br>: docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.Expected.html<br><br><br><br>Developer Guide*.
more information, see [Expected] in the *Amazon DynamoDB
This is a legacy parameter. Use `ConditionExpression` instead. For
@!attribute [rw] expected
@return [Hash<String,Types::AttributeValueUpdate>]<br>: docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributeUpdates.html<br><br><br><br>Developer Guide*.
information, see [AttributeUpdates] in the *Amazon DynamoDB
This is a legacy parameter. Use `UpdateExpression` instead. For more
@!attribute [rw] attribute_updates
@return [Hash<String,Types::AttributeValue>]
values for both the partition key and the sort key.
for the partition key. For a composite primary key, you must provide
example, with a simple primary key, you only need to provide a value
For the primary key, you must provide all of the attributes. For
an attribute name and a value for that attribute.
The primary key of the item to be updated. Each element consists of
@!attribute [rw] key
@return [String]
parameter.
provide the Amazon Resource Name (ARN) of the table in this
The name of the table containing the item to update. You can also
@!attribute [rw] table_name
Represents the input of an `UpdateItem` operation.