Skip to content

Commit

Permalink
Merge pull request boto#3574 from collinstocks/develop
Browse files Browse the repository at this point in the history
boto.dynamodb2.table.Table#batch_get() fails to paginate results if provisioned throughput is exceeded
  • Loading branch information
jamesls authored Aug 3, 2016
2 parents 62fa79a + df7f7ce commit abb3847
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions boto/dynamodb2/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ def get_item(self, consistent=False, attributes=None, **kwargs):
should be fetched)
Returns an ``Item`` instance containing all the data for that record.
Raises an ``ItemNotFound`` exception if the item is not found.
Example::
Expand Down Expand Up @@ -1581,9 +1581,9 @@ def _batch_get(self, keys, consistent=False, attributes=None):
})
results.append(item)

raw_unproccessed = raw_results.get('UnprocessedKeys', {})
raw_unprocessed = raw_results.get('UnprocessedKeys', {}).get(self.table_name, {})

for raw_key in raw_unproccessed.get('Keys', []):
for raw_key in raw_unprocessed.get('Keys', []):
py_key = {}

for key, value in raw_key.items():
Expand Down
10 changes: 6 additions & 4 deletions tests/unit/dynamodb2/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ def test_fetch_more(self):
self.assertFalse(self.results._results_left)

def test_fetch_more_empty(self):
self.results.to_call(lambda keys: {'results': [], 'last_key': None})
self.results.to_call(lambda keys: {'results': [], 'last_key': None})

self.results.fetch_more()
self.assertEqual(self.results._results, [])
Expand Down Expand Up @@ -2913,9 +2913,11 @@ def test_private_batch_get(self):
# Now alter the expected.
del expected['Responses']['users'][2]
expected['UnprocessedKeys'] = {
'Keys': [
{'username': {'S': 'jane',}},
],
'users': {
'Keys': [
{'username': {'S': 'jane',}},
],
},
}

with mock.patch.object(
Expand Down

0 comments on commit abb3847

Please sign in to comment.