小编Raw*_*Kim的帖子

python3 dynamoDB Update_item 不起作用

我只是在 AWS dynamoDB 中练习使用示例代码 但是,更新代码不会出现错误

botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the UpdateItem operation: The document path provided in the update expression is invalid for update
Run Code Online (Sandbox Code Playgroud)

我的python代码在这里。我可以在没有“地图”属性的情况下更新数据库。


table = dynamodb.Table('Movies')

title = "The Big New Movie"
year = 2015

response = table.update_item(
    Key={
        "year": year,
        "title": title
    },
    UpdateExpression="set #attrName.rating = :r, #attrName.plot=:p",
    ExpressionAttributeNames = {
        "#attrName" : "info"
    },
    ExpressionAttributeValues={
        ':r': decimal.Decimal(5.5),
        ':p': "Everything happens all at once."
    },
    ReturnValues="UPDATED_NEW"
)
Run Code Online (Sandbox Code Playgroud)

python python-3.x amazon-dynamodb boto3

7
推荐指数
1
解决办法
7198
查看次数

标签 统计

amazon-dynamodb ×1

boto3 ×1

python ×1

python-3.x ×1