dynamorm
dynamorm copied to clipboard
How can I persist a schemaless dict where some of the entry values are None?
I need dynamorm not to strip out None
s in some cases. The data isn't structured, so I can't map it to a marshmallow schema and rely on missing=None
.
class Model(DynaModel):
class Table:
name = 'table'
hash_key = "key"
class Schema:
key = marshmallow.fields.Integer()
some_formless_data = marshmallow.fields.Dict()
m = Model(key=1, some_formless_data={'foo': 'bar', 'noneval': None})
m.save()
same = Model.get(key=1)
same.some_formless_data
>> {'foo': 'bar'}
It's not saving the entries whose values are None. This seems like a common issue -- how do I persist and save a value as a None?