'What is the best way to model key in DynamoDB (Migration from RDS to NoSql)

We are trying to migrate a Oracle based system to use DyanmoDBNoSQL.

Primary key in the Oracle is a complex object with multiple attributes (>6) and in DynamoDB there can be maximum 2 keys (Partition key and sort key) . How to model this in DynamoDB ?

We are considering generating a surrogate key using SHA 256 hashing. Is it a good design ?

Thanks, Hareendra



Solution 1:[1]

generate surrogate key is a good idea.

a good guide to design dynamodb tables is here: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GuidelinesForTables.html

Solution 2:[2]

It sounds like you're describing a natural key rather than surrogate key. While I advise using surrogate key, you may not be able to avoid this. In this case, it is common practice in DDB data model design to compose composite keys as a function of many attributes, delineated by some separator. I haven't yet used >6 fields, but I don't see why not.

I'm an AWS employee and currently working on multiple systems in which we compose a partition key like Field1Value::Field2Value::FieldValue3. The size quotas on PK/SK wouldn't prevent you using 6 or more fields here.

Solution 3:[3]

In researching how this might be done, I found hadoopDependencyCoordinates property here: https://druid.apache.org/docs/0.22.1/ingestion/hadoop.html#task-syntax

which seems relevant.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eyal Ch
Solution 2 lance.dolan
Solution 3 Sergio Ferragut