From 8612e9d78223d56949eba53ef32bedc4bde0e7de Mon Sep 17 00:00:00 2001 From: jexhson Date: Fri, 14 Mar 2014 16:37:01 +0100 Subject: [PATCH] Use hash_key in query to filter returned items --- moto/dynamodb/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/moto/dynamodb/models.py b/moto/dynamodb/models.py index 67f5152d6..f49607023 100644 --- a/moto/dynamodb/models.py +++ b/moto/dynamodb/models.py @@ -182,7 +182,11 @@ class Table(object): results = [] last_page = True # Once pagination is implemented, change this - possible_results = list(self.all_items()) + if self.range_key_attr: + possible_results = self.items[hash_key].values() + else: + possible_results = list(self.all_items()) + if range_comparison: for result in possible_results: if result.range_key.compare(range_comparison, range_objs):