Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Commit

Permalink
Merge pull request #2 from bitly/ver_0.2.4
Browse files Browse the repository at this point in the history
Ver 0.2.4
  • Loading branch information
mreiferson committed Feb 29, 2012
2 parents d98b9a0 + 896f9a9 commit b47d9e7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
4 changes: 4 additions & 0 deletions 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 Version 0.2.3 - 2012-02-06
* Always pass error argument * Always pass error argument


Expand Down
4 changes: 2 additions & 2 deletions asyncdynamo/__init__.py
Expand Up @@ -28,5 +28,5 @@
except ImportError: except ImportError:
raise ImportError("boto library not installed. Install boto. https://github.com/boto/boto") raise ImportError("boto library not installed. Install boto. https://github.com/boto/boto")


version = "0.2.3" version = "0.2.4"
version_info = (0, 2, 3) version_info = (0, 2, 4)
16 changes: 15 additions & 1 deletion asyncdynamo/asyncdynamo.py
Expand Up @@ -167,6 +167,20 @@ def batch_get_item(self, request_items, callback):
data = {'RequestItems' : request_items} data = {'RequestItems' : request_items}
json_input = json.dumps(data) json_input = json.dumps(data)
self.make_request('BatchGetItem', json_input, callback) 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, def query(self, table_name, hash_key_value, callback, range_key_conditions=None,
attributes_to_get=None, limit=None, consistent_read=False, attributes_to_get=None, limit=None, consistent_read=False,
Expand All @@ -178,7 +192,7 @@ def query(self, table_name, hash_key_value, callback, range_key_conditions=None,
data = {'TableName': table_name, data = {'TableName': table_name,
'HashKeyValue': hash_key_value} 'HashKeyValue': hash_key_value}
if range_key_conditions: if range_key_conditions:
data['RangeKeyConditions'] = range_key_conditions data['RangeKeyCondition'] = range_key_conditions
if attributes_to_get: if attributes_to_get:
data['AttributesToGet'] = attributes_to_get data['AttributesToGet'] = attributes_to_get
if limit: if limit:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -2,7 +2,7 @@
from distutils.core import setup from distutils.core import setup


# also update version in __init__.py # also update version in __init__.py
version = '0.2.3' version = '0.2.4'


setup( setup(
name="asyncdynamo", name="asyncdynamo",
Expand Down

0 comments on commit b47d9e7

Please sign in to comment.