Moto: dynamodb update item with nested item issue

Created on 15 Nov 2017  路  5Comments  路  Source: spulec/moto

Hi,

When I update_item with Update expression as
SET #name1.#name2 = :value'
where name1 is a map

When I scan and read the item, I get the result as
'Name1.Name2':
the item is saved as #name1.#name2 instead of a map structure. Is it a known issue

bug

All 5 comments

Not a known issue as far as im aware, can you create a simple test case for this and i'll look into it

I have the same issue. It seems UpdateExpression doesn't work with Nested Map Attributes properly. I'm using mock_dynamodb2.

If I run something like this

table.update_item(
            Key={
                'ID': id,
            },
            UpdateExpression='SET ResultMap.#final.#key = :status',
            ExpressionAttributeNames={
                '#final': 'Final',
                '#key': 'Key'
            },
            ExpressionAttributeValues={
                ':status': 'new status'
            }
        )

and then read the data with scan, a result item contains a new attribute with the key 'ResultMap.Final.Key' instead of updating a nested attribute. It works properly if I run my function in AWS.

moto version 1.1.24

Should fix it. No guarantees but it fixes @VitalyIvanov's example

@terrycain Great! Thank you! My use case now works just fine.

No problem mate. Glad its working, that bit of the code is proper evil :D

Was this page helpful?
0 / 5 - 0 ratings

Related issues

domingosnovo picture domingosnovo  路  5Comments

joelhess picture joelhess  路  5Comments

dazza-codes picture dazza-codes  路  3Comments

sturmer picture sturmer  路  3Comments

mdavis-xyz picture mdavis-xyz  路  4Comments