PynamoDB Dynamic Attribute

81 Views Asked by At

I need to save a key and a value in DynamoDB using PynamoDB. The key is a string but the value could be anything (i.e. string, boolean, number).

Due to the value requirement, I cannot declare the type of the value attribute when creating my model because it is not known what the type is going to be.

I was able to achieve this goal by using DynamicMapAttribute. The problem, however, is that the value then is stores in DDB as nested, that is, underneath a root element I create.

Is it possible to achieve this objective by storing the value as a plain attribute? Perhaps if something like DynamicAttribute (that is without Map) existed.

I tried DynamicMapAttribute but it creates a nested attribute in DynamoDB

0

There are 0 best solutions below