Recently, I experienced a situation where I defined an attribute in DynamoDB as a number (Ex: 4.12334) then while updating the attribute I mistakenly wrote a string data to it (Ex: "4.12334").
This happened when I used json.dumps with default as str (I used str as default to overcome error:Object of type Decimal is not JSON serializable) in python resulting conversion of number (Decimal) to string and it was my mistake that I oversaw this conversion hence when I wrote to dynamoDB, type of attribute got updated to string (which is expected).
I know that dynamoDB is schemaless and it is perfectly fine that the attributes can take any value type at any time except the primary key (including partition and sort keys).
My question is:
Is there any kind of mechanism to enforce schema on dynamoDB to overcome situations like change of data type?
I know that this cannot be achieved by dynamoDB itself because it is a schemaless. I am looking for any libraries or packages in any language(python, JS etc) that would put a schema layer on dynamoDB. And all write and read to dynamoDB are done through this library/package.