One or more substitution tokens for attribute names in an expression. The following are some use cases for
using ExpressionAttributeNames
:
-
To access an attribute whose name conflicts with a DynamoDB reserved word.
-
To create a placeholder for repeating occurrences of an attribute name in an expression.
-
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the
following attribute name:
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression.
(For the complete list of reserved words, see Reserved Words
in the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for
ExpressionAttributeNames
:
You could then use this substitution in an expression, as in this example:
Tokens that begin with the : character are expression attribute values, which are placeholders
for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.