dynamodb: fix deleting last set element (w/attr name) (#3708)
* dynamodb: deleting last set element * add user-facing test
This commit is contained in:
parent
e61d794cbc
commit
0912abe5f6
3 changed files with 49 additions and 9 deletions
|
|
@ -165,8 +165,18 @@ class DeleteExecutor(NodeExecutor):
|
|||
# the last item in the set, we have to remove the attribute.
|
||||
if not string_set_list:
|
||||
element = self.get_element_to_action()
|
||||
if isinstance(element, ExpressionAttributeName):
|
||||
attribute_name = self.expression_attribute_names[
|
||||
element.get_attribute_name_placeholder()
|
||||
]
|
||||
elif isinstance(element, ExpressionAttribute):
|
||||
attribute_name = element.get_attribute_name()
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
"Moto does not support deleting {t} yet".format(t=type(element))
|
||||
)
|
||||
container = self.get_item_before_end_of_path(item)
|
||||
container.pop(element.get_attribute_name())
|
||||
del container[attribute_name]
|
||||
|
||||
|
||||
class RemoveExecutor(NodeExecutor):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue