Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to update a hash key in amazon dynamo db

I want to update hash key value in amazon dynamo db table.I also have a range key in the same table.Is it possible to do this?

like image 308
ilce Avatar asked Jun 16 '16 09:06

ilce


People also ask

Can you update a key in DynamoDB?

To update an existing item in an Amazon DynamoDB table, you use the UpdateItem operation. You must provide the key of the item that you want to update. You must also provide an update expression, indicating the attributes that you want to modify and the values that you want to assign to them.

Can you update partition key value in DynamoDB?

Is it possible to change partition key in DynamoDB? No. Once the table is setup, you cannot modify its Key Schema. You can only provision a new table, move data there, and then remove the first table.

Is DynamoDB hash key unique?

"Hash and Range Primary Key" means that a single row in DynamoDB has a unique primary key made up of both the hash and the range key. For example with a hash key of X and range key of Y, your primary key is effectively XY.

Can DynamoDB have multiple hash keys?

Using normal DynamoDB operations you're allowed to query either only one hash key per request (using GetItem or Query operations) or all hash keys at once (using the Scan operation).


1 Answers

You cannot update the hash key value, you will have to delete and recreate the item.

Here is the relevant aws documentation http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_AttributeValueUpdate.html

like image 98
Shibashis Avatar answered Oct 16 '22 05:10

Shibashis