Skip to content Skip to sidebar Skip to footer

Query Dynamodb With Non Hash Key Field (with Boto / Python)

I'm using dynamoDB with boto, and having a bit of a problem in the design/query of my table. I'd like my data to look something like +---------------------------------------+ hash_

Solution 1:

I would use the account_id as the hash_key along with some range_key to differentiate them.

In DynamoDB, the primary key is composed of a (hash_key, range_key) range_key being optional. This tuple needs to be unique. Note that you will need the whole tuple to access a given element with get_item.

Having an 'auto_increment' hash_key is a bad habit from the SQL world.

If you want to know more on this subject, I wrote some background do on modeling data in the dynamodb-mapper documentation: http://dynamodb-mapper.readthedocs.org/en/latest/api/model.html#auto-increment-when-to-use

Post a Comment for "Query Dynamodb With Non Hash Key Field (with Boto / Python)"