I have a dynamoDB table with the key name as id and a String field called state. I just want to update the value of the state using update_item DynamoDb Python client.
DDB_CLIENT.update_item(
Key={
'id' : {'S': id}
},
TableName='TrackingState',
UpdateExpression="set state = :r",
ExpressionAttributeValues={
':r': '"state": {"S": "IN_PROGRESS"}'
}
)
I get an error: Invalid type for parameter ExpressionAttributeValues type: <class 'str'>, valid types: <class 'dict'>
If I try expressionAttributeValues as:
':r' : {"state": {"S": "IN_PROGRESS"}} I get the error: Unknown parameter in ExpressionAttributeValues.:r: "state", must be one of: S, N, B, SS, NS, BS, M, L, NULL, BOOL
If I try
':r' : {"S": "QUEUED"}
Invalid UpdateExpression: Attribute name is a reserved keyword; reserved keyword: state
What is the right way to update an entry in DynamoDb table