I have a pre-existing dynamo db table to which i want to add a primary sort key. All the items in the table contain the key which i want to delegate as the primary sort key.
DynamoDB doesn't allow to add Sort key for the existing table. It allows the following once the table is created. Modifies the provisioned throughput settings, global secondary indexes, or DynamoDB Streams settings for a given table.
Can we update the sort key in DynamoDB? No, you can not update the sort key after the table is provisioned. However, you can create a new table and put the existing data in the newly created table, and delete the old table.
DynamoDB does not require schema definition, and so there is no such thing as a "column". You can just add a new item with a new attribute.
DynamoDB supports two types of primary keys: Partition key: A simple primary key, composed of one attribute known as the partition key.
DynamoDB doesn't allow to add Sort key for the existing table.
It allows the following once the table is created.
Modifies the provisioned throughput settings, global secondary indexes, or DynamoDB Streams settings for a given table.
Solution:-
Please create a new table with redefined key attributes and copy the data from old table to new table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With