Dynamic Attributes and Integer Increments #235
Replies: 2 comments 3 replies
-
Hey @shortjared 👋 Are you getting an error when you try to perform an That said, if the issue is related to the path not existing (no Let me know about the error message you see, whether what you're seeing is an error path issue, and/or if any of the alternative models I put above work for your use case 👍 |
Beta Was this translation helpful? Give feedback.
-
You are correct in the not having the property ahead of time being part of the issue with regards to Part of the issue is I don't know the names of the properties ahead of time. If Electro had a way to allow "dynamic" patterned top level properties, I could arbitrarily use
I know this isn't a core concern of the lib, so no worries if there isn't a clean way to figure it out! |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm trying to figure out if it would be possible to model a dynamic map and do integer increments on values in the map. Most my attempts so far have failed with DynamoDB saying the update expression is invalid, since electro puts things in
ADD #attr :attr
instead of something likeSET #attr.#prop = if_not_exists(#attr.#prop, :defaultZero) + :incr
There is the additional issue of deep nesting not being a thing you can do if the item doesn't already exist in dynamodb of course. Ideally it would be nice to have a way to do dynamic top level props.
Playground Link
Part of the problem is needing a dynamic map. This is useful for things like tracking aggregates. Any ideas how I could approach this differently with Electro?
Beta Was this translation helpful? Give feedback.
All reactions