Invalid UpdateExpression: Invalid operand type for operator or function; operator: ADD, operand type: LIST

I tried using ADD in UpdateExpression to add an email line to the rowset, as shown below, but caught this exception: Invalid UpdateExpression: invalid operand type for operator or function; operator: ADD, operand type: LIST.

I think the point is that I need a way to change the type to a "set of strings", but I'm not sure what semantics are to achieve this.

response = wishesTable.update_item( Key={ 'title': wishTitle, 'userMail': wishUsermail }, UpdateExpression='ADD whoLikeList :my_value', ExpressionAttributeValues={ ":my_value": [userEmail] }, ReturnValues="UPDATED_NEW" ) 
+1
source share
1 answer

Referring to the TypeSerializer class ( http://boto3.readthedocs.io/en/latest/_modules/boto3/dynamodb/types.html )

By changing the code below, it will be processed as installed:

  response = wishesTable.update_item( Key={ 'title': wishTitle, 'userMail': wishUsermail }, UpdateExpression='ADD whoLikeList :my_value', ExpressionAttributeValues={ ":my_value": set([userEmail]) }, ReturnValues="UPDATED_NEW" ) 
+1
source

All Articles