Created
January 29, 2022 14:57
-
-
Save em-shea/6a414311d5ce17a704d48a0264ad27a8 to your computer and use it in GitHub Desktop.
Example of DynamoDB single table design for a daily vocabapp (NoSQL Workbench json)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ModelName": "full-table-design", | |
"ModelMetadata": { | |
"Author": "", | |
"DateCreated": "Jun 04, 2021, 05:33 PM", | |
"DateLastModified": "Jun 16, 2021, 11:01 PM", | |
"Description": "", | |
"AWSService": "Amazon DynamoDB", | |
"Version": "3.0" | |
}, | |
"DataModel": [ | |
{ | |
"TableName": "full-table-design", | |
"KeyAttributes": { | |
"PartitionKey": { | |
"AttributeName": "PK", | |
"AttributeType": "S" | |
}, | |
"SortKey": { | |
"AttributeName": "SK", | |
"AttributeType": "S" | |
} | |
}, | |
"NonKeyAttributes": [ | |
{ | |
"AttributeName": "Email address", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "Username", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "Character set preference", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "List name", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "Subscribed status", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "Date subscribed", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "Date unsubscribed", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "List id", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "Word", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "Date", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "Quiz details", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "GSI1PK", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "GSI1SK", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "List difficulty level", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "Simplified", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "Traditional", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "Pinyin", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "Definition", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "Word id", | |
"AttributeType": "S" | |
} | |
], | |
"GlobalSecondaryIndexes": [ | |
{ | |
"IndexName": "Leaderboard-view", | |
"KeyAttributes": { | |
"PartitionKey": { | |
"AttributeName": "GSI1PK", | |
"AttributeType": "S" | |
}, | |
"SortKey": { | |
"AttributeName": "GSI1SK", | |
"AttributeType": "S" | |
} | |
}, | |
"Projection": { | |
"ProjectionType": "ALL" | |
} | |
} | |
], | |
"TableData": [ | |
{ | |
"PK": { | |
"S": "USER#123-e3d6-4076-8fe4-052957b98c12" | |
}, | |
"SK": { | |
"S": "USER#123-e3d6-4076-8fe4-052957b98c12" | |
}, | |
"Email address": { | |
"S": "me@123.com" | |
}, | |
"Username": { | |
"S": "小沈" | |
}, | |
"Character set preference": { | |
"S": "Simplified" | |
}, | |
"GSI1PK": { | |
"S": "USER" | |
}, | |
"GSI1SK": { | |
"S": "USER#123-e3d6-4076-8fe4-052957b98c12" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "USER#234-e749-402c-aa06-60a604c0de82" | |
}, | |
"SK": { | |
"S": "USER#234-e749-402c-aa06-60a604c0de82" | |
}, | |
"Email address": { | |
"S": "me@234.com" | |
}, | |
"Username": { | |
"S": "小陈" | |
}, | |
"Character set preference": { | |
"S": "Traditional" | |
}, | |
"GSI1PK": { | |
"S": "USER" | |
}, | |
"GSI1SK": { | |
"S": "USER#234-e749-402c-aa06-60a604c0de82" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "USER#123-e3d6-4076-8fe4-052957b98c12" | |
}, | |
"SK": { | |
"S": "LIST#1" | |
}, | |
"Character set preference": { | |
"S": "Simplified" | |
}, | |
"List name": { | |
"S": "HSK Level 1" | |
}, | |
"Subscribed status": { | |
"S": "Subscribed" | |
}, | |
"Date subscribed": { | |
"S": "2021-06-08T21:37:33" | |
}, | |
"GSI1PK": { | |
"S": "USER" | |
}, | |
"GSI1SK": { | |
"S": "USER#123-e3d6-4076-8fe4-052957b98c12#LIST#1#SIMPLIFIED" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "USER#234-e749-402c-aa06-60a604c0de82" | |
}, | |
"SK": { | |
"S": "LIST#2" | |
}, | |
"Character set preference": { | |
"S": "Traditional" | |
}, | |
"List name": { | |
"S": "HSK Level 2" | |
}, | |
"Subscribed status": { | |
"S": "Unsubscribed" | |
}, | |
"Date subscribed": { | |
"S": "2021-06-08T21:36:22" | |
}, | |
"Date unsubscribed": { | |
"S": "2021-06-08T21:37:13" | |
}, | |
"GSI1PK": { | |
"S": "USER" | |
}, | |
"GSI1SK": { | |
"S": "USER#234-e749-402c-aa06-60a604c0de82#LIST#2#TRADITIONAL" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "USER#123-e3d6-4076-8fe4-052957b98c12" | |
}, | |
"SK": { | |
"S": "QUIZ#1ebc896a-ee52-605e-8c1b-acde48001122" | |
}, | |
"List id": { | |
"S": "1" | |
}, | |
"Date": { | |
"S": "2021-06-08 (created first)" | |
}, | |
"Quiz details": { | |
"S": "{ \"List id\": \"1\", \"Question count\": \"10\", \"Quiz percentage\": \"50%\", \"Question details\": [ { \"...\"} ] }" | |
}, | |
"GSI1PK": { | |
"S": "DATE#2021-06-08" | |
}, | |
"GSI1SK": { | |
"S": "QUIZ#1ebc896a-ee52-605e-8c1b-acde48001122" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "USER#123-e3d6-4076-8fe4-052957b98c12" | |
}, | |
"SK": { | |
"S": "QUIZ#1ebc896f-ded7-6d04-8bef-acde48001122" | |
}, | |
"List id": { | |
"S": "1" | |
}, | |
"Date": { | |
"S": "2021-06-08 (created second)" | |
}, | |
"Quiz details": { | |
"S": "{ \"List id\": \"1\", \"Question count\": \"10\", \"Quiz percentage\": \"50%\", \"Question details\": [ { \"...\"} ] }" | |
}, | |
"GSI1PK": { | |
"S": "DATE#2021-06-08" | |
}, | |
"GSI1SK": { | |
"S": "QUIZ#1ebc896f-ded7-6d04-8bef-acde48001122" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "USER#123-e3d6-4076-8fe4-052957b98c12" | |
}, | |
"SK": { | |
"S": "SENTENCE#1ebc8970-26f9-697a-a378-acde48001122" | |
}, | |
"List id": { | |
"S": "1" | |
}, | |
"Word": { | |
"S": "{ \"word details\" }" | |
}, | |
"Date": { | |
"S": "2021-06-08 (created first)" | |
}, | |
"GSI1PK": { | |
"S": "DATE#2021-06-08" | |
}, | |
"GSI1SK": { | |
"S": "SENTENCE#1ebc8970-26f9-697a-a378-acde48001122" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "USER#234-e749-402c-aa06-60a604c0de82" | |
}, | |
"SK": { | |
"S": "SENTENCE#1ebc8973-6865-6a96-8b75-acde48001122" | |
}, | |
"List id": { | |
"S": "2" | |
}, | |
"Word": { | |
"S": "{ \"word details\" }" | |
}, | |
"Date": { | |
"S": "2021-06-08 (created second)" | |
}, | |
"GSI1PK": { | |
"S": "DATE#2021-06-08" | |
}, | |
"GSI1SK": { | |
"S": "SENTENCE#1ebc8973-6865-6a96-8b75-acde48001122" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "USER#234-e749-402c-aa06-60a604c0de82" | |
}, | |
"SK": { | |
"S": "SENTENCE#1ebc8973-dc16-6846-baf0-acde48001122" | |
}, | |
"List id": { | |
"S": "2" | |
}, | |
"Word": { | |
"S": "{ \"word details\" }" | |
}, | |
"Date": { | |
"S": "2021-06-08 (created third)" | |
}, | |
"GSI1PK": { | |
"S": "DATE#2021-06-08" | |
}, | |
"GSI1SK": { | |
"S": "SENTENCE#1ebc8973-dc16-6846-baf0-acde48001122" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "LIST#1" | |
}, | |
"SK": { | |
"S": "LIST#1" | |
}, | |
"List name": { | |
"S": "HSK Level 1" | |
}, | |
"GSI1PK": { | |
"S": "CREATEDBY#ADMIN" | |
}, | |
"GSI1SK": { | |
"S": "LIST#1" | |
}, | |
"List difficulty level": { | |
"S": "Beginner" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "LIST#2" | |
}, | |
"SK": { | |
"S": "LIST#2" | |
}, | |
"List name": { | |
"S": "HSK Level 2" | |
}, | |
"GSI1PK": { | |
"S": "CREATEDBY#USER#123" | |
}, | |
"GSI1SK": { | |
"S": "LIST#2" | |
}, | |
"List difficulty level": { | |
"S": "Intermediate" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "LIST#3" | |
}, | |
"SK": { | |
"S": "LIST#3" | |
}, | |
"List name": { | |
"S": "HSK Level 3" | |
}, | |
"GSI1PK": { | |
"S": "CREATEDBY#USER#234" | |
}, | |
"GSI1SK": { | |
"S": "LIST#3" | |
}, | |
"List difficulty level": { | |
"S": "Advanced" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "WORD#123" | |
}, | |
"SK": { | |
"S": "WORD#123" | |
}, | |
"Simplified": { | |
"S": "我" | |
}, | |
"Traditional": { | |
"S": "我" | |
}, | |
"Pinyin": { | |
"S": "wo3" | |
}, | |
"Definition": { | |
"S": "Me, myself" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "WORD#234" | |
}, | |
"SK": { | |
"S": "WORD#234" | |
}, | |
"Simplified": { | |
"S": "你" | |
}, | |
"Traditional": { | |
"S": "你" | |
}, | |
"Pinyin": { | |
"S": "ni3" | |
}, | |
"Definition": { | |
"S": "You" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "WORD#345" | |
}, | |
"SK": { | |
"S": "WORD#345" | |
}, | |
"Simplified": { | |
"S": "你好" | |
}, | |
"Traditional": { | |
"S": "你好" | |
}, | |
"Pinyin": { | |
"S": "ni3hao3" | |
}, | |
"Definition": { | |
"S": "Hello, hi" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "LIST#1" | |
}, | |
"SK": { | |
"S": "WORD#123" | |
}, | |
"Word": { | |
"S": "{ \"word details\" }" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "LIST#1" | |
}, | |
"SK": { | |
"S": "WORD#234" | |
}, | |
"Word": { | |
"S": "{ \"word details\" }" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "LIST#2" | |
}, | |
"SK": { | |
"S": "WORD#345" | |
}, | |
"Word": { | |
"S": "{ \"word details\" }" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "LIST#1" | |
}, | |
"SK": { | |
"S": "DATESENT#2021-06-08" | |
}, | |
"Word": { | |
"S": "{ \"word details\" }" | |
}, | |
"Word id": { | |
"S": "123" | |
} | |
}, | |
{ | |
"PK": { | |
"S": "LIST#2" | |
}, | |
"SK": { | |
"S": "DATESENT#2021-06-08" | |
}, | |
"Word": { | |
"S": "{ \"word details\" }" | |
}, | |
"Word id": { | |
"S": "345" | |
} | |
} | |
], | |
"DataAccess": { | |
"MySql": {} | |
}, | |
"BillingMode": "PROVISIONED", | |
"ProvisionedCapacitySettings": { | |
"ProvisionedThroughput": { | |
"ReadCapacityUnits": 5, | |
"WriteCapacityUnits": 5 | |
}, | |
"AutoScalingRead": { | |
"ScalableTargetRequest": { | |
"MinCapacity": 1, | |
"MaxCapacity": 10, | |
"ServiceRole": "AWSServiceRoleForApplicationAutoScaling_DynamoDBTable" | |
}, | |
"ScalingPolicyConfiguration": { | |
"TargetValue": 70 | |
} | |
}, | |
"AutoScalingWrite": { | |
"ScalableTargetRequest": { | |
"MinCapacity": 1, | |
"MaxCapacity": 10, | |
"ServiceRole": "AWSServiceRoleForApplicationAutoScaling_DynamoDBTable" | |
}, | |
"ScalingPolicyConfiguration": { | |
"TargetValue": 70 | |
} | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment