I'm trying to add value to the attribute "dataname" which is type LIST in the dynamoDB table.
response = table.update_item(
Key={"name": xyz},
UpdateExpression="SET dataname = list_append(dataname, :i)"
ExpressionAttributeValues={
':i': [1200, readonly],
},
)
The above logic works only if the attribute "dataname" is already present in the item. If the attribute is not present it gives the following error: "The provided expression refers to an attribute that does not exist in the item".
Is there a way to add the attribute "dataname" if it does not exist in the item and then update the values ? I'm using Python language for this.