#2212 add support for delete on update_with_attribute_updates (#2213)

* add support for delete on update_with_attribute_updates
This commit is contained in:
Ber Zoidberg 2019-05-22 02:47:02 -07:00 committed by Terry Cain
commit 1088c421d2
2 changed files with 41 additions and 0 deletions

View file

@ -294,6 +294,19 @@ class Item(BaseModel):
# TODO: implement other data types
raise NotImplementedError(
'ADD not supported for %s' % ', '.join(update_action['Value'].keys()))
elif action == 'DELETE':
if set(update_action['Value'].keys()) == set(['SS']):
existing = self.attrs.get(attribute_name, DynamoType({"SS": {}}))
new_set = set(existing.value).difference(set(new_value))
self.attrs[attribute_name] = DynamoType({
"SS": list(new_set)
})
else:
raise NotImplementedError(
'ADD not supported for %s' % ', '.join(update_action['Value'].keys()))
else:
raise NotImplementedError(
'%s action not support for update_with_attribute_updates' % action)
class StreamRecord(BaseModel):