From f958209db060d25667ae7d077720cff7254765f3 Mon Sep 17 00:00:00 2001 From: Dan Frank Date: Tue, 21 Feb 2012 19:45:54 +0000 Subject: [PATCH 1/3] add put_item method --- asyncdynamo/asyncdynamo.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/asyncdynamo/asyncdynamo.py b/asyncdynamo/asyncdynamo.py index cb0a5e1..356e596 100644 --- a/asyncdynamo/asyncdynamo.py +++ b/asyncdynamo/asyncdynamo.py @@ -167,6 +167,20 @@ def batch_get_item(self, request_items, callback): data = {'RequestItems' : request_items} json_input = json.dumps(data) self.make_request('BatchGetItem', json_input, callback) + + def put_item(self, table_name, item, callback, expected=None, return_values=None, object_hook=None): + ''' + Issues an async request to create a new item or replace an old one. + ''' + data = {'TableName' : table_name, + 'Item' : item} + if expected: + data['Expected'] = expected + if return_values: + data['ReturnValues'] = return_values + json_input = json.dumps(data) + return self.make_request('PutItem', json_input, callback=callback, + object_hook=object_hook) def query(self, table_name, hash_key_value, callback, range_key_conditions=None, attributes_to_get=None, limit=None, consistent_read=False, From bc84f8f2233918ef83f44d5a554ce712ef0b2de6 Mon Sep 17 00:00:00 2001 From: Dan Frank Date: Wed, 22 Feb 2012 20:00:05 +0000 Subject: [PATCH 2/3] fix idiotic querying range key condition bug --- asyncdynamo/asyncdynamo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asyncdynamo/asyncdynamo.py b/asyncdynamo/asyncdynamo.py index 356e596..36ec9a4 100644 --- a/asyncdynamo/asyncdynamo.py +++ b/asyncdynamo/asyncdynamo.py @@ -192,7 +192,7 @@ def query(self, table_name, hash_key_value, callback, range_key_conditions=None, data = {'TableName': table_name, 'HashKeyValue': hash_key_value} if range_key_conditions: - data['RangeKeyConditions'] = range_key_conditions + data['RangeKeyCondition'] = range_key_conditions if attributes_to_get: data['AttributesToGet'] = attributes_to_get if limit: From 896f9a9096a9c60fe17d7ff16218701b1d58c30f Mon Sep 17 00:00:00 2001 From: Dan Frank Date: Thu, 23 Feb 2012 19:29:40 +0000 Subject: [PATCH 3/3] version 0.2.4 --- CHANGELOG | 4 ++++ asyncdynamo/__init__.py | 4 ++-- setup.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9bfcad9..1f92aec 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +Version 0.2.4 - 2012-02-23 + * Fix RangeKeyAttribute bug in queries + * Add put_item method + Version 0.2.3 - 2012-02-06 * Always pass error argument diff --git a/asyncdynamo/__init__.py b/asyncdynamo/__init__.py index 8620207..b2639bf 100644 --- a/asyncdynamo/__init__.py +++ b/asyncdynamo/__init__.py @@ -28,5 +28,5 @@ except ImportError: raise ImportError("boto library not installed. Install boto. https://github.com/boto/boto") -version = "0.2.3" -version_info = (0, 2, 3) +version = "0.2.4" +version_info = (0, 2, 4) diff --git a/setup.py b/setup.py index 58ffffe..5c38395 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from distutils.core import setup # also update version in __init__.py -version = '0.2.3' +version = '0.2.4' setup( name="asyncdynamo",