Merge pull request #100 from JeffMGreg/master
Query order/limit enforced. Scan limit enforced
This commit is contained in:
commit
418592e865
@ -42,6 +42,18 @@ class DynamoType(object):
|
|||||||
self.value == other.value
|
self.value == other.value
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __lt__(self, other):
|
||||||
|
return self.value < other.value
|
||||||
|
|
||||||
|
def __le__(self, other):
|
||||||
|
return self.value <= other.value
|
||||||
|
|
||||||
|
def __gt__(self, other):
|
||||||
|
return self.value > other.value
|
||||||
|
|
||||||
|
def __ge__(self, other):
|
||||||
|
return self.value >= other.value
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "DynamoType: {0}".format(self.to_json())
|
return "DynamoType: {0}".format(self.to_json())
|
||||||
|
|
||||||
@ -196,6 +208,8 @@ class Table(object):
|
|||||||
else:
|
else:
|
||||||
# If we're not filtering on range key, return all values
|
# If we're not filtering on range key, return all values
|
||||||
results = possible_results
|
results = possible_results
|
||||||
|
|
||||||
|
results.sort(key=lambda item: item.range_key)
|
||||||
return results, last_page
|
return results, last_page
|
||||||
|
|
||||||
def all_items(self):
|
def all_items(self):
|
||||||
|
@ -238,7 +238,11 @@ class DynamoHandler(BaseResponse):
|
|||||||
if items is None:
|
if items is None:
|
||||||
er = 'com.amazonaws.dynamodb.v20111205#ResourceNotFoundException'
|
er = 'com.amazonaws.dynamodb.v20111205#ResourceNotFoundException'
|
||||||
return self.error(er)
|
return self.error(er)
|
||||||
|
|
||||||
|
limit = self.body.get("Limit")
|
||||||
|
if limit:
|
||||||
|
items = items[:limit]
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
"Count": len(items),
|
"Count": len(items),
|
||||||
"Items": [item.attrs for item in items],
|
"Items": [item.attrs for item in items],
|
||||||
@ -270,6 +274,10 @@ class DynamoHandler(BaseResponse):
|
|||||||
er = 'com.amazonaws.dynamodb.v20111205#ResourceNotFoundException'
|
er = 'com.amazonaws.dynamodb.v20111205#ResourceNotFoundException'
|
||||||
return self.error(er)
|
return self.error(er)
|
||||||
|
|
||||||
|
limit = self.body.get("Limit")
|
||||||
|
if limit:
|
||||||
|
items = items[:limit]
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
"Count": len(items),
|
"Count": len(items),
|
||||||
"Items": [item.attrs for item in items],
|
"Items": [item.attrs for item in items],
|
||||||
|
Loading…
Reference in New Issue
Block a user