From 6972e6c01d029f6cf22f05f501faba2d90ce69e9 Mon Sep 17 00:00:00 2001 From: Eran Duchan Date: Tue, 14 Jul 2020 15:39:56 +0300 Subject: [PATCH] wip --- tests/test_client.py | 9 ++++++++- v3io/dataplane/client.py | 23 +++++++++++++++++++---- v3io/dataplane/request.py | 3 --- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index ac34997..9b71bff 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -478,12 +478,19 @@ def test_put_items(self): } response = self._client.put_items(container=self._container, - path=self._path, items=items) + path=self._path, + items=items) self.assertTrue(response.success) self._verify_items(self._path, items) + # delete an item + self._client.delete_item(container=self._container, path=self._path + '/linda') + del(items['linda']) + + self._verify_items(self._path, items) + def test_put_items_with_error(self): items = { 'bob': {'age': 42, 'feature': 'mustache'}, diff --git a/v3io/dataplane/client.py b/v3io/dataplane/client.py index 7f25675..4e1a436 100644 --- a/v3io/dataplane/client.py +++ b/v3io/dataplane/client.py @@ -291,8 +291,7 @@ def put_item(self, access_key=None, raise_for_status=None, transport_actions=None, - condition=None, - update_mode=None): + condition=None): """Creates an item with the provided attributes. If an item with the same name (primary key) already exists in the specified table, the existing item is completely overwritten (replaced with a new item). If the item or table do not exist, the operation creates them. @@ -318,8 +317,6 @@ def put_item(self, The access key with which to authenticate. Defaults to the V3IO_ACCESS_KEY env. condition (Optional) : str A Boolean condition expression that defines a conditional logic for executing the put-item operation. - update_mode (Optional) : str - CreateOrReplaceAttributes (default): Creates or replaces attributes Return Value ---------- @@ -551,6 +548,24 @@ def get_items(self, locals(), v3io.dataplane.output.GetItemsOutput) + def delete_item(self, container, path, access_key=None, raise_for_status=None, transport_actions=None): + """Deletes an item. + + Parameters + ---------- + container (Required) : str + The container on which to operate. + path (Required) : str + The path of the item + access_key (Optional) : str + The access key with which to authenticate. Defaults to the V3IO_ACCESS_KEY env. + + Return Value + ---------- + A `Response` object. + """ + return self.delete_object(container, path, access_key, raise_for_status, transport_actions) + # # Stream # diff --git a/v3io/dataplane/request.py b/v3io/dataplane/request.py index 09ece2a..b3eefe6 100644 --- a/v3io/dataplane/request.py +++ b/v3io/dataplane/request.py @@ -129,9 +129,6 @@ def encode_put_item(container_name, access_key, kwargs): if kwargs['condition'] is not None: body['ConditionExpression'] = kwargs['condition'] - if kwargs['update_mode'] is not None: - body['UpdateMode'] = kwargs['update_mode'] - return _encode('PUT', container_name, access_key,