Dynamoid / dynamoid

Ruby ORM for Amazon's DynamoDB.
MIT License
582 stars 195 forks source link

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

Closed rwilliams3088 closed 3 months ago

rwilliams3088 commented 3 months ago

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: https://github.com/Dynamoid/dynamoid/issues/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!

andrykonchin commented 3 months ago

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.