DynamoDB Physical Model

Schema for:

Model name: Messaging
Author: Pascal
Version: 0.1
File name: Messaging.json
File path: C:\Users\Pascal\Bitbucket\hackolade\schemas\DynamoDB\Messaging.json
Printed On: Sat Mar 11 2017 10:56:08 GMT+0100 (Romance Standard Time)
Created with: Hackolade - Visual data modeling for NoSQL and multimodel databases
1. Model
1.1 Model Messaging
1.1.1 Messaging Entity Relationship Diagram
1.1.2 Messaging Properties
PropertyValue
Name Messaging
Description DAT-401 YouTube video https://www.youtube.com/watch?v=ggDIat_FZtA&t=3s by Rick Houlihan, Principal Solutions Architect
Author Pascal
Version 1
DB Vendor AWS DynamoDB
Db Version
Comments
1.1.3 Messaging Database Users
1.1.4 Messaging DB Definitions
2. Table
2.1 Region eu-west-1
2.1.2 eu-west-1 Properties
PropertyValue
Region name eu-west-1
Description
Comments
2.1. eu-west-1 Tables
2.1.3.1 Table messagesEmbedded
2.1.3.1.1 messagesEmbedded Tree Diagram
{BNR}
[0]
type
[...]
attachments
type
{ABC}
body
type
{ABC}
subject
type
{ABC}
sender
type
{ABC}
date
type
{ABC}
recipient
type
messagesEmbedded
type
{BNR}
[0]
type
[...]
attachments
type
{ABC}
body
type
{ABC}
subject
type
{ABC}
sender
type
{ABC}
date
type
{ABC}
recipient
type
messagesEmbedded
type
2.1.3.1.2 messagesEmbedded Properties
PropertyValue
Table name messagesEmbedded
Id
Description Problem is that it ends up costing 1600 RCU to read 50 messages, with formula: Items evaluated by query * Avg item size * Conversion ratio * Consistent/Eventually consistent reads = # of RCU 50 * 256kb * (1 RCU /4kb) * (1/2) = 1600 RCU
Region 8641c3e0-0640-11e7-8ad3-83453b80bb7b
Additional properties false
Comments
Partition key (hash) recipient
Sort key (range) date
Read capacity units 5
Write capacity units 5
Stream Enabled false
Stream View Type Keys only
2.1.3.1.3 messagesEmbedded Attributes
AttributeTypeReqKeyDescription
recipientstringtrue
datestringtrue
senderstringtrue
subjectstringtrue
bodystringtrue
attachmentsarrayfalse
[0]binaryfalse
2.1.3.1.3.1 Attribute recipient
2.1.3.1.3.1.1 recipient Tree Diagram
{ABC}
recipient
type
{ABC}
recipient
type
recipient properties
PropertyValue
Name recipient
Id
Type string
Composite Attribute
Description
Dependencies
Required true
Partition key (hash) true
Sort key (range)
Foreign table users
Foreign attribute users.user
Relationship type Foreign Key
Default
Min length
Max length
Pattern
Format
Enum
Sample David
Comments
2.1.3.1.3.2 Attribute date
2.1.3.1.3.2.1 date Tree Diagram
{ABC}
date
type
{ABC}
date
type
date properties
PropertyValue
Name date
Id
Type string
Composite Attribute
Description
Dependencies
Required true
Partition key (hash)
Sort key (range) true
Foreign table
Foreign attribute
Relationship type
Default
Min length
Max length
Pattern
Format
Enum
Sample 2014-10-02
Comments
2.1.3.1.3.3 Attribute sender
2.1.3.1.3.3.1 sender Tree Diagram
{ABC}
sender
type
{ABC}
sender
type
sender properties
PropertyValue
Name sender
Id
Type string
Composite Attribute
Description
Dependencies
Required true
Partition key (hash)
Sort key (range)
Foreign table users
Foreign attribute users.user
Relationship type Foreign Key
Default
Min length
Max length
Pattern
Format
Enum
Sample Bob
Comments
2.1.3.1.3.4 Attribute subject
2.1.3.1.3.4.1 subject Tree Diagram
{ABC}
subject
type
{ABC}
subject
type
subject properties
PropertyValue
Name subject
Id
Type string
Composite Attribute
Description
Dependencies
Required true
Partition key (hash)
Sort key (range)
Foreign table
Foreign attribute
Relationship type
Default
Min length
Max length
Pattern
Format
Enum
Sample
Comments
2.1.3.1.3.5 Attribute body
2.1.3.1.3.5.1 body Tree Diagram
{ABC}
body
type
{ABC}
body
type
body properties
PropertyValue
Name body
Id
Type string
Composite Attribute
Description
Dependencies
Required true
Partition key (hash)
Sort key (range)
Foreign table
Foreign attribute
Relationship type
Default
Min length
Max length
Pattern
Format
Enum
Sample Blablabla
Comments
2.1.3.1.3.6 Attribute attachments
2.1.3.1.3.6.1 attachments Tree Diagram
{BNR}
[0]
type
attachments
type
{BNR}
[0]
type
attachments
type
2.1.3.1.3.6.2 attachments Hierarchy
Parent Attribute: messagesEmbedded
Child attribute(s):
AttributeTypeReqKeyDescription
[0]binaryfalse
attachments properties
PropertyValue
Name attachments
Id
Type list
Description
Dependencies
Required false
Foreign table
Foreign attribute
Relationship type
Min items
Max items
Unique items false
Additional items false
Comments
2.1.3.1.3.7 Attribute [0]
2.1.3.1.3.7.1 [0] Tree Diagram
{BNR}
[0]
type
{BNR}
[0]
type
[0] properties
PropertyValue
Name
Id
Type binary
Composite Attribute
Description
Dependencies
Required false
Partition key (hash)
Sort key (range)
Foreign table
Foreign attribute
Relationship type
GridFS
Comments
2.1.3.1.4 messagesEmbedded Users (TBD)
2.1.3.1.5 messagesEmbedded Indexes
2.1.3.1.6 messagesEmbedded Sharding (TBD)
2.1.3.1.7 messagesEmbedded Definitions
2.1.3.1.8 messagesEmbedded JSON Schema
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Problem is that it ends up costing 1600 RCU to read 50 messages, with formula:\n\nItems evaluated by query * Avg item size * Conversion ratio * Consistent/Eventually consistent reads = # of RCU\n\n50 * 256kb * (1 RCU /4kb) * (1/2) = 1600 RCU\n",
    "additionalProperties": false,
    "properties": {
        "recipient": {
            "partitionKey": true,
            "primaryKey": true,
            "sample": "David",
            "type": "string",
            "GUID": "00e89780-b8ea-11e6-8089-6f1f31218a06"
        },
        "date": {
            "primaryKey": true,
            "sample": "2014-10-02",
            "type": "string",
            "GUID": "00e89782-b8ea-11e6-8089-6f1f31218a06",
            "sortKey": true
        },
        "sender": {
            "primaryKey": false,
            "sample": "Bob",
            "type": "string",
            "GUID": "00e8be90-b8ea-11e6-8089-6f1f31218a06"
        },
        "subject": {
            "primaryKey": false,
            "type": "string",
            "GUID": "00e8be92-b8ea-11e6-8089-6f1f31218a06"
        },
        "body": {
            "primaryKey": false,
            "sample": "Blablabla",
            "type": "string",
            "GUID": "00e8be93-b8ea-11e6-8089-6f1f31218a06"
        },
        "attachments": {
            "primaryKey": false,
            "type": "list",
            "GUID": "00e8be94-b8ea-11e6-8089-6f1f31218a06",
            "additionalItems": false,
            "uniqueItems": false,
            "items": {
                "primaryKey": false,
                "type": "binary",
                "GUID": "00e8be95-b8ea-11e6-8089-6f1f31218a06",
                "arrayItem": true
            }
        }
    },
    "type": "object",
    "readCapacity": 5,
    "streamEnabled": false,
    "streamViewType": "Keys only",
    "writeCapacity": 5,
    "required": [
        "recipient",
        "date",
        "sender",
        "subject",
        "body"
    ]
}
2.1.3.1.9 messagesEmbedded JSON data
{
    "recipient": "David",
    "date": "2014-10-02",
    "sender": "Bob",
    "subject": "Lorem",
    "body": "Blablabla"
}
2.1.3.2 Table users
2.1.3.2.1 users Tree Diagram
{ABC}
[0]
type
[...]
nicknames
type
{ABC}
user
type
users
type
{ABC}
[0]
type
[...]
nicknames
type
{ABC}
user
type
users
type
2.1.3.2.2 users Properties
PropertyValue
Table name users
Id
Description
Region 8641c3e0-0640-11e7-8ad3-83453b80bb7b
Additional properties false
Comments
Partition key (hash) user
Sort key (range)
Read capacity units 5
Write capacity units 5
Stream Enabled false
Stream View Type Keys only
2.1.3.2.3 users Attributes
AttributeTypeReqKeyDescription
userstringtrue
nicknamesarraytrue
[0]stringfalse
2.1.3.2.3.1 Attribute user
2.1.3.2.3.1.1 user Tree Diagram
{ABC}
user
type
{ABC}
user
type
user properties
PropertyValue
Name user
Id
Type string
Composite Attribute
Description
Dependencies
Required true
Partition key (hash) true
Sort key (range)
Foreign table
Foreign attribute
Relationship type
Default
Min length
Max length
Pattern
Format
Enum
Sample Bob
Comments
2.1.3.2.3.2 Attribute nicknames
2.1.3.2.3.2.1 nicknames Tree Diagram
{ABC}
[0]
type
nicknames
type
{ABC}
[0]
type