DynamoDB : SET list_append not working using aws sdk

前端 未结 4 1532
南旧
南旧 2020-12-16 11:03

I need to append a string to a string set in a dynamodb table using the corresponding key. This is the Update expression I use to do updateItem :

  var param         


        
4条回答
  •  没有蜡笔的小新
    2020-12-16 11:44

    maybe this will help someone. i was struggling with updating a list and was getting the same error message as the original poster. i managed to solve my problem when i finally understood the documentation (see the Adding Elements To a List example here http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.ADD)

    points to note are: 1) that the "list_append takes two lists as input, and appends the second list to the first." and 2) that ExpressionAttributeValues is a list! like this:

    {
    ":vals": {
        "L": [
            { "S": "Screwdriver" },
            {"S": "Hacksaw" }
        ]
    }
    

    }

    good luck!

提交回复
热议问题