bloop icon indicating copy to clipboard operation
bloop copied to clipboard

Support empty values for non-key String and Binary attributes

Open numberoverzero opened this issue 5 years ago • 0 comments

Announcement here and PutItem reference here

Empty String and Binary attribute values are allowed. Attribute values of type String and Binary must have a length greater than zero if the attribute is used as a key attribute for a table or index.

This may be a breaking change if "" changes from meaning "no value please ensure deletion during update" to "put an empty value". From Type._dump and String.dynamo_dump it appears that "" gets transformed to None before _dump and then returns actions.wrap(None) (implemented here) which returns NONE_SENTINEL (defined here as a remove action).

There's a question about where key vs non-key constraints are handled. Since load/dump take a context object we could push is_key=True into the context and let the load/dump function sort out validity, or keep it simple and let the caller inspect the returned value and throw exceptions.

Finally, there's probably some complexity around DynamicType and StringSet/BinarySet that need to be figured out.

Some links to provide context around current design decisions and where changes are anticipated:

numberoverzero avatar May 28 '20 20:05 numberoverzero