Horcrux7
Horcrux7

Reputation: 24457

DynamoDbException: No Hash Key specified in schema. All Dynamo DB tables must have exactly one hash key

It is possible with DynamoDB to create a global secondary index only with a RANGE key without a HASH key? If yes, how?

If no, can I update an item attribute that is used in a global secondary index HASH key?

Background: I have only 100 - 1000 items in the table. In an extremely worst case about 100 thousand entries.

A workaround is to save a dummy value with a fix value which I can use as HASH key.

Upvotes: 0

Views: 1392

Answers (1)

Maurice
Maurice

Reputation: 13162

All tables and Global Secondary Indexes need a HASH-Key, it's not optional.

You can update the hash key value for GSIs, changes are asynchronously replicated into the Global Secondary index. That's why you can only perform eventually consistent reads on it.

Upvotes: 1

Related Questions