query raises DynamoDBResponseError when hash key not found

Issue #9 resolved
Alan Descoins
created an issue


I am using ddbmock together with DynamoDB-mapper.

If boto is not patched, the following returns an empty list (because DynamoDB table for MyModel does not contain any item with hash key 'something'):


However if using ddbmock to patch boto, the same code raises this exception:

DynamoDBResponseError: DynamoDBResponseError: 500 InternalServerError
{'message': "KeyError: ('hash_key=something not found',)", '__type': 'com.amazonaws.dynamodb.v20111205#InternalFailure'}

I haven't debugged any further but can this be ddbmock's fault?


Comments (9)

  1. Jean-Tiare Le Bigot

    Thanks for reporting, I really appreciate.

    Indeed, the patch version is more permeable to internal failures but still this is weird. I currently very busy with my studies, is it OK if I have a deeper look at it this Week-End ?

  2. Jean-Tiare Le Bigot

    The root cause of the bug was in the Query sub-system which was raising a KeyError when the hash_key was not found instead of returning an empty result set. Here is the detailed fix: https://bitbucket.org/Ludia/dynamodb-mock/commits/65f252215c8e#Lddbmock/database/table.pyF317

    Please note that you might still get minor inconsistencies regarding internal exception reporting between both entry points as I did not investigate it.

    Can you confirm it addresses your issue ?

  3. Log in to comment