更新属性“时间戳”保留字

77

我需要使用boto3更新我的dynamodb表中的时间戳属性,但属性名“timestamp”是一个保留字,所以在SET命令上会抛出错误。

table.update_item(
    Key={
        'id': item_id
    },
    UpdateExpression='SET timestamp = :val1', # this is the line giving the problem
    ExpressionAttributeValues={
        ":val1": new_timestamp
    }
)

"errorMessage": "在调用 UpdateItem 操作时发生错误 (ValidationException): 无效的 UpdateExpression: 属性名称是保留关键字; 保留关键字:timestamp",

1个回答

221

3
谢谢,非常顺利。没想到他们把这些视为保留字。 - LeOn - Han Li
我们如何使用这种模式进行多个字段更新? - Naman Jain

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接