【发布时间】:2022-01-01 22:47:17
【问题描述】:
我正在尝试在 aws 中使用 python 更新我的分区键,但我真的不知道是否可以更新它?
def modifyItem(URL_ADDRESS, updateKey, updateValue):
try:
response = table.update_item(
Key={
'URL_ADDRESS': URL_ADDRESS
},
UpdateExpression='set %s = :value' % updateKey,
ExpressionAttributeValues={
':value':updateValue
},
ReturnValues='UPDATED_NEW'
)
body = {
'Operation': 'UPDATE',
'Message': 'SUCCESS',
'UpdatedAttributes': response
}
return buildResponse(200, body)
【问题讨论】:
-
不要相信您可以更新分区键。您必须编写一个新项目并删除旧项目。
标签: python amazon-web-services amazon-dynamodb crud