Dynamoid/dynamoid

Saving Empty Strings To The Database (non-key fields)

Closed this issue · 1 comments

I have some non-key fields that are occasionally the empty string. I would like to preserve these empty string values in DynamoDB, but currently the Dynamoid API appears to not be preserving the attribute if it is a blank string.

DynamoDB has supported writing empty strings to non-key fields for several years now. I found an issue on here from back in 2021 asking for this same thing: #504

Has any optional configuration been added since then that I could enable to support preserving empty strings via Dynamoid? Or is this still a yet to be supported feature?

Thanks!

Yeah, indeed empty strings aren't persisted in Dynamoid now (and saved as nil). And introducing a config option would be helpful to enable this behaviour (to have it enabled by default in the next major release). Will work on it.