Let's say I have an item in the test table in DynamoDB like this:
test: {
{
id:'100',
page:'#test',
general: {
foo: 'super_foo',
bar: {
item:'string_item'
}
}
}
}
I'd like to find a way to make it end up like:
test: {
{
id:'100',
page:'#test',
general: {
foo: 'super_foo',
bar: {
item:'string_item'
},
bbb: { 'bbbb':'cccc' },
ccc: 'dddd'
}
}
}
I tried the following (in python, using boto3):
table.update_item(
Key = {
'id': '100',
'page': 'page_name'
},
UpdateExpression= "set #g=:r",
ExpressionAttributeValues={
':r': { 'bbb': { 'bbbb':'cccc' }, 'ccc': 'dddd' },
},
ExpressionAttributeNames = {
'#g': 'general'
},
)
...but it only erased the items I already had:
test: {
{
id:'100',
page:'#test',
general: {
bbb: { 'bbbb':'cccc' },
ccc: 'dddd'
}
}
}
Is this possible to do?