3 個答案
- 最新
- 最多得票
- 最多評論
0
Hi, I am reviewing this now, and will send you an update once I have more information. Thank you.
已回答 5 年前
0
I tried the following:
#Existing item json:
c:\PADMA\UTILS\SCRIPTS>aws dynamodb scan --table-name example
{
"Items": [
{
"pk": {
"N": "1"
},
"example1": {
"M": {
"example2": {
"M": {
"name2": {
"S": "a"
},
"name1": {
"S": "blabla"
}
}
}
}
},
"sk": {
"S": "key"
}
}
],
"Count": 1,
"ScannedCount": 1,
"ConsumedCapacity": null
}
#Update command:
table.update_item(
Key={
'pk': pk,
'sk': sk
},
UpdateExpression="set example1.example2.name3=:x",
ExpressionAttributeValues={
':x': "new value"
},
ReturnValues="UPDATED_NEW"
)
#Updated item json:
c:\PADMA\UTILS\SCRIPTS>aws dynamodb scan --table-name example
{
"Items": [
{
"pk": {
"N": "1"
},
"example1": {
"M": {
"example2": {
"M": {
"name1": {
"S": "blabla"
},
"name2": {
"S": "a"
},
"name3": {
"S": "new value"
}
}
}
}
},
"sk": {
"S": "key"
}
}
],
"Count": 1,
"ScannedCount": 1,
"ConsumedCapacity": null
}
Is this what you are trying to do? I am getting the expected results. I followed this tutorial: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.Python.01.html
Can you try this out. And let me know if you are still having trouble with this?
已回答 5 年前
0
Yes, that's work
My mistake was that one of my values had to be created in a new object, but since the object did not exist, it did not understand the path.
Thanks for your help
已回答 5 年前
相關內容
- 已提問 1 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 7 個月前