Closed rchepya1 closed 5 years ago
PR: https://github.com/4ossiblellc/dynamodb-update-expression/pull/18
This would replace the uuid containing '-' with uuid without the special char in the keys of UpdateExpression, ExpressionAttributeNames, ExpressionAttributeValues and doesn't replace in values. Values shouldn't be replaced since it maps to the dynamoDb's key/id
Closed this issue.
Dynamodb update doesn't allow special character '-' in ExpressionAttributeNames and ExpressionAttributeValues. But it could be present in the dynamoDb. For example UUID can be a key in an object.
{ "xyz": { "fd324157-7aaa-4ef4-baa5-47952b9e189b": { "abc": "abcValue", "pqr": { "pqrKey": "pqrValue" } } } }
If something's updated in 'abc' - UpdateExpression is : "SET #xyz.#fd324157-7aaa-4ef4-baa5-47952b9e189b.#abc = :xyzfd324157-7aaa-4ef4-baa5-47952b9e189babc, ExpressionAttributeNames : #fd324157-7aaa-4ef4-baa5-47952b9e189b : "fd324157-7aaa-4ef4-baa5-47952b9e189b" ExpressionAttributeValues: :xyzfd324157-7aaa-4ef4-baa5-47952b9e189babc : "newValue"
The special char '-' is not allowed here. But is needed in ExpressionAttributeNames's value.
Error: ExpressionAttributeNames contains invalid key: Syntax error; key: "#fd324157-7aaa-4ef4-baa5-47952b9e189b"