3 Answers
- Newest
- Most votes
- Most comments
0
Hi, I am reviewing this now, and will send you an update once I have more information. Thank you.
answered 5 years ago
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?
answered 5 years ago
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
answered 5 years ago
Relevant content
- asked 9 days ago
- asked a year ago
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 years ago