Update __init__.py (#4024)

In case of DELETE action we don't pass the value if we want to remove the attribute.
There are more cases but it's for you to handle.
This commit is contained in:
Avi Slavkin 2021-06-23 18:53:05 +03:00 committed by GitHub
parent fb9c9c3876
commit 6fb05d6453
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,6 +120,8 @@ class Item(BaseModel):
def validate_no_empty_key_values(self, attribute_updates, key_attributes):
for attribute_name, update_action in attribute_updates.items():
action = update_action.get("Action") or "PUT" # PUT is default
if action == "DELETE":
continue
new_value = next(iter(update_action["Value"].values()))
if action == "PUT" and new_value == "" and attribute_name in key_attributes:
raise EmptyKeyAttributeException