I am updating a counter in dynamodb and it works fine, but I would also like to do an additional update based on the value.
response=table.update_item(
Key={
"record_key":record_key_val,
"record_type":f"REPROC|{assignment_id}"
},
UpdateExpression="""
SET #attempt = #attempt + :val,
#last_status_code = :last_status_code
""",
ExpressionAttributeNames={
"#attempt": "attempt",
"#last_status_code" : "last_status_code"
},
ExpressionAttributeValues={
":val": 1,
":last_status_code": last_status_code
},
ReturnValues='UPDATED_NEW',
)
BUT I would like to add this logic in the update too
I have attribute "status" with value RETRY and would like to update it to EXPIRE after attempt > 10.
So what I think I need is ExpressionAttributeValues to have conditional logic. Can that be done?