Skip to content
v2.274.0

DynamoAttributeValue Class ​

Represents the data for an attribute.

Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.

Example ​

ts
declare const myTable: dynamodb.Table;
new tasks.DynamoDeleteItem(this, 'DeleteItem', {
  key: { MessageId: tasks.DynamoAttributeValue.fromString('message-007') },
  table: myTable,
  resultPath: sfn.JsonPath.DISCARD,
});

Properties ​

attributeValueanyattribute_valueAnyattributeValueObjectAttributeValueobjectAttributeValueinterface{}required#
Represents the data for the attribute.

Data can be i.e. "S": "Hello"

Methods ​

booleanFromJsonata(value: string): DynamoAttributeValue // chainable@staticmethod def boolean_from_jsonata(value: str) -> DynamoAttributeValuepublic static DynamoAttributeValue booleanFromJsonata(String value)public static DynamoAttributeValue BooleanFromJsonata(string value)func BooleanFromJsonata(Value *string) DynamoAttributeValuestatic#
Sets an attribute of type Boolean from state input through JSONata expression.

For example: "BOOL": true

1 parameter

Parameters

  • valuevaluevaluevalueValue — JSONata expression that specifies state input to be used.
booleanFromJsonPath(value: string): DynamoAttributeValue // chainable@staticmethod def boolean_from_json_path(value: str) -> DynamoAttributeValuepublic static DynamoAttributeValue booleanFromJsonPath(String value)public static DynamoAttributeValue BooleanFromJsonPath(string value)func BooleanFromJsonPath(Value *string) DynamoAttributeValuestatic#
Sets an attribute of type Boolean from state input through Json path.

For example: "BOOL": true

1 parameter

Parameters

  • valuevaluevaluevalueValue — Json path that specifies state input to be used.
fromBinary(value: string): DynamoAttributeValue // chainable@staticmethod def from_binary(value: str) -> DynamoAttributeValuepublic static DynamoAttributeValue fromBinary(String value)public static DynamoAttributeValue FromBinary(string value)func FromBinary(Value *string) DynamoAttributeValuestatic#
Sets an attribute of type Binary.

For example: "B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"

1 parameter

Parameters

  • valuevaluevaluevalueValue — base-64 encoded string.
fromBinarySet(value: string[]): DynamoAttributeValue // chainable@staticmethod def from_binary_set(value: typing.List[str]) -> DynamoAttributeValuepublic static DynamoAttributeValue fromBinarySet(List<String> value)public static DynamoAttributeValue FromBinarySet(string[] value)func FromBinarySet(Value *[]*string) DynamoAttributeValuestatic#
Sets an attribute of type Binary Set.

For example: "BS": ["U3Vubnk=", "UmFpbnk=", "U25vd3k="]

fromBoolean(value: boolean): DynamoAttributeValue // chainable@staticmethod def from_boolean(value: bool) -> DynamoAttributeValuepublic static DynamoAttributeValue fromBoolean(Boolean value)public static DynamoAttributeValue FromBoolean(bool value)func FromBoolean(Value *bool) DynamoAttributeValuestatic#
Sets an attribute of type Boolean.

For example: "BOOL": true

fromList(value: DynamoAttributeValue[]): DynamoAttributeValue // chainable@staticmethod def from_list(value: typing.List[DynamoAttributeValue]) -> DynamoAttributeValuepublic static DynamoAttributeValue fromList(List<DynamoAttributeValue> value)public static DynamoAttributeValue FromList(DynamoAttributeValue[] value)func FromList(Value *[]DynamoAttributeValue) DynamoAttributeValuestatic#
Sets an attribute of type List.

For example: "L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"N", "3.14159"}]

fromMap(value: { [key: string]: DynamoAttributeValue }): DynamoAttributeValue // chainable@staticmethod def from_map(value: typing.Mapping[str, DynamoAttributeValue]) -> DynamoAttributeValuepublic static DynamoAttributeValue fromMap(Map<String, DynamoAttributeValue> value)public static DynamoAttributeValue FromMap(IDictionary<string, DynamoAttributeValue> value)func FromMap(Value *map[string]DynamoAttributeValue) DynamoAttributeValuestatic#
Sets an attribute of type Map.

For example: "M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}

fromNull(value: boolean): DynamoAttributeValue // chainable@staticmethod def from_null(value: bool) -> DynamoAttributeValuepublic static DynamoAttributeValue fromNull(Boolean value)public static DynamoAttributeValue FromNull(bool value)func FromNull(Value *bool) DynamoAttributeValuestatic#
Sets an attribute of type Null.

For example: "NULL": true

fromNumber(value: number): DynamoAttributeValue // chainable@staticmethod def from_number(value: int | float) -> DynamoAttributeValuepublic static DynamoAttributeValue fromNumber(Number value)public static DynamoAttributeValue FromNumber(double value)func FromNumber(Value *float64) DynamoAttributeValuestatic#
Sets a literal number.

For example: 1234 Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

fromNumberSet(value: number[]): DynamoAttributeValue // chainable@staticmethod def from_number_set(value: typing.List[int | float]) -> DynamoAttributeValuepublic static DynamoAttributeValue fromNumberSet(List<Number> value)public static DynamoAttributeValue FromNumberSet(double[] value)func FromNumberSet(Value *[]*float64) DynamoAttributeValuestatic#
Sets an attribute of type Number Set.
notes

For example: "NS": ["42.2", "-19", "7.5", "3.14"] Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

fromString(value: string): DynamoAttributeValue // chainable@staticmethod def from_string(value: str) -> DynamoAttributeValuepublic static DynamoAttributeValue fromString(String value)public static DynamoAttributeValue FromString(string value)func FromString(Value *string) DynamoAttributeValuestatic#
Sets an attribute of type String.
notes

For example: "S": "Hello" Strings may be literal values or as JSONata expression or as JsonPath. Example values:

  • DynamoAttributeValue.fromString('someValue')
  • DynamoAttributeValue.fromString('{% $bar %}')
  • DynamoAttributeValue.fromString(JsonPath.stringAt('$.bar'))
fromStringSet(value: string[]): DynamoAttributeValue // chainable@staticmethod def from_string_set(value: typing.List[str]) -> DynamoAttributeValuepublic static DynamoAttributeValue fromStringSet(List<String> value)public static DynamoAttributeValue FromStringSet(string[] value)func FromStringSet(Value *[]*string) DynamoAttributeValuestatic#
Sets an attribute of type String Set. For example: "SS": ["Giraffe", "Hippo" ,"Zebra"].

This method only accepts static arrays defined at CDK synthesis time. Dynamic value resolution via JSONata or JsonPath is not supported for Set types.

listFromJsonata(value: string): DynamoAttributeValue // chainable@staticmethod def list_from_jsonata(value: str) -> DynamoAttributeValuepublic static DynamoAttributeValue listFromJsonata(String value)public static DynamoAttributeValue ListFromJsonata(string value)func ListFromJsonata(Value *string) DynamoAttributeValuestatic#
Sets an attribute of type List.

For example: "L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"S", "Veggies"}]

1 parameter

Parameters

  • valuevaluevaluevalueValue — JSONata expression that specifies state input to be used.
listFromJsonPath(value: string): DynamoAttributeValue // chainable@staticmethod def list_from_json_path(value: str) -> DynamoAttributeValuepublic static DynamoAttributeValue listFromJsonPath(String value)public static DynamoAttributeValue ListFromJsonPath(string value)func ListFromJsonPath(Value *string) DynamoAttributeValuestatic#
Sets an attribute of type List.

For example: "L": [ {"S": "Cookies"} , {"S": "Coffee"}, {"S", "Veggies"}]

1 parameter

Parameters

  • valuevaluevaluevalueValue — Json path that specifies state input to be used.
mapFromJsonata(value: string): DynamoAttributeValue // chainable@staticmethod def map_from_jsonata(value: str) -> DynamoAttributeValuepublic static DynamoAttributeValue mapFromJsonata(String value)public static DynamoAttributeValue MapFromJsonata(string value)func MapFromJsonata(Value *string) DynamoAttributeValuestatic#
Sets an attribute of type Map.

For example: "M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}

1 parameter

Parameters

  • valuevaluevaluevalueValue — JSONata expression that specifies state input to be used.
mapFromJsonPath(value: string): DynamoAttributeValue // chainable@staticmethod def map_from_json_path(value: str) -> DynamoAttributeValuepublic static DynamoAttributeValue mapFromJsonPath(String value)public static DynamoAttributeValue MapFromJsonPath(string value)func MapFromJsonPath(Value *string) DynamoAttributeValuestatic#
Sets an attribute of type Map.

For example: "M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}

1 parameter

Parameters

  • valuevaluevaluevalueValue — Json path that specifies state input to be used.
numberFromString(value: string): DynamoAttributeValue // chainable@staticmethod def number_from_string(value: str) -> DynamoAttributeValuepublic static DynamoAttributeValue numberFromString(String value)public static DynamoAttributeValue NumberFromString(string value)func NumberFromString(Value *string) DynamoAttributeValuestatic#
Sets an attribute of type Number.
notes

For example: "N": "123.45" Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

Numbers may be expressed as literal strings or as JSONata expression or as JsonPath

numberSetFromStrings(value: string[]): DynamoAttributeValue // chainable@staticmethod def number_set_from_strings(value: typing.List[str]) -> DynamoAttributeValuepublic static DynamoAttributeValue numberSetFromStrings(List<String> value)public static DynamoAttributeValue NumberSetFromStrings(string[] value)func NumberSetFromStrings(Value *[]*string) DynamoAttributeValuestatic#
Sets an attribute of type Number Set.
notes

For example: "NS": ["42.2", "-19", "7.5", "3.14"] Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.

Numbers may be expressed as literal strings or as JsonPath

toObject(): anydef to_object(self, ) -> Anypublic Object toObject()public object ToObject()func ToObject() interface{}#
Returns the DynamoDB attribute value.