I want to update an item in Dynamodb such that I can set the value of one attribute based on the value of an existing attribute in that item. For example: I have table with the following item {"id": 1, "valueone": 30}.
I want to update this item such that I can add another attribute valuetwo whose value is twice that of valueone: {"id": 1, "valueone": 30, "valuetwo": 60}
Something like this, but not sure how to represent valueone in the ExpressionAttributeValues:
table.update_item(Key={'id': 1}, UpdateExpression="set vtwo = :two * :r", ExpressionAttributeValues={':r': valueone, ':two': 2},ReturnValues="ALL_NEW"))
I can control whether valuetwo is a new attribute in the item or already exists with a dummy value (say zero).