in api/utils.py [0:0]
def to_update_kwargs(attributes):
"""
For an attribute dictionary, make a default update expression for setting the values
Notes: Use an expression attribute name to replace that attribute's name with reserved word in the expression,
reference can be found here:
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ExpressionAttributeNames.html#ExpressionAttributeNames
"""
return {
'UpdateExpression': 'set {}'.format(', '.join([f"#{k} = :{k}" for k in attributes])),
'ExpressionAttributeValues': {f":{k}": v for k, v in attributes.items()},
'ExpressionAttributeNames': {f"#{k}": k for k in attributes}
}