Boto3 update multiple values

in the boto3 documentation, updating an element is described in the following example:

table.update_item( Key={ 'username': 'janedoe', 'last_name': 'Doe' }, UpdateExpression='SET age = :val1', ExpressionAttributeValues={ ':val1': 26 } ) 

But what should I do if I want to update multiple element values. I could not find any information about this. Can anyone help? Thanks!

EDIT:

Well, it looks like this is so, can someone confirm that this is the right way. Just to be sure that I am not doing anything completely wrong here.

 table.update_item( Key={ 'id': item['id'] }, UpdateExpression='SET value1 = :val1, value2 = :val2', ExpressionAttributeValues={ ':val1': someValue1, ':val2': someValue2 } ) 

Thanks!

+6
source share
1 answer

Yes, that’s the way to do it. Even many actions can be performed in one expression, as shown here here . For example: multiple "PUT" and "DELETE" in one expression.

Snapshot showing the example from document

+3
source

All Articles