Merge pull request #1127 from brianrower/feature/add-string-set

Dynamodb2 - Allow doing an ADD update_item of a string set
This commit is contained in:
Jack Danger 2017-09-11 12:33:41 -07:00 committed by GitHub
commit d7e64fc927
2 changed files with 36 additions and 0 deletions

View file

@ -172,6 +172,12 @@ class Item(BaseModel):
decimal.Decimal(existing.value) +
decimal.Decimal(new_value)
)})
elif set(update_action['Value'].keys()) == set(['SS']):
existing = self.attrs.get(attribute_name, DynamoType({"SS": {}}))
new_set = set(existing.value).union(set(new_value))
self.attrs[attribute_name] = DynamoType({
"SS": list(new_set)
})
else:
# TODO: implement other data types
raise NotImplementedError(