Amazon DynamoDB Data Modeler

☰ menu
× Create Model Clear Indexes Clear Model Load Model Save Model Import OneTable


Welcome to the DynamoDB Data Modeler. This utility creates a data model with one or more virtual Tables, allowing users to visualize how relational data might be stored and indexed in DynamoDB in order to help design efficient schema for your application. The tool is fully compatible with the NoSQL Workbench for DynamoDB, and models generated by either tool are interchangeable. Any changes made in either tool can be easily exported and loaded into the other to facilitate collaboration with users who may be working in environments that do not allow installation of desktop applications like NoSQL Workbench for DynamoDB.

The data displayed by the DynamoDB Data Modeler is stored locally in memory as a collection of virtual Tables, allowing complex data models to be easily constructed and validated without requiring resources to be created in an AWS account space. Unlike other tools for visualizing data, both the DynamoDB Data Modeler online tool and the NoSQL Workbench for DynamoDB are designed specifically to model NoSQL data and do not assume that the items being displayed are homogenous in nature. The Table will display many types of items as a single aggregated view representing a DynamoDB data model.

Getting Started

To get started with a new model, select 'Create Model' from the options menu. To import an existing model use the 'Load Model' option. When 'Create Model' is selected you will be prompted to provide a Model Name, Author and Description and then asked to define the first Table in the Data Model. When a new Table is defined, the DynamoDB Data Modeler wiill build an empty Table with a single Item that looks similar to the following image:

Using the Amazon DynamoDB Data Modeler

Certain elements in the Table view are decorated with controls that can be used for the following actions:

Click the swap '' control to add a new Table or select an existing Table from the current Model to view.

Click the back '' control to undo a change to the currently selected Table. The modeler caches up to 50 changes for each Table in the currently loaded Model. The change cache is cleared when a new Model is loaded.

Finally, click the add '' control:

  1. On the Table Name tab to create a new index:

  2. In the Primary Key header cell to add a new partition:

  3. In a Partition Key value cell to add a new item to a partition:

  4. In a Sort Key value cell to add a new attribute to an Item:

The following image shows a data model for tracking patients, room assignments, and treatments for a hospital resource scheduling service originally created in NoSQL Workbench for DynamoDB (Hospital.json):

Clicking the add '' symbol in the "Primary Key" field of the Table header will add a new Item to the bottom of the Table, as shown in the following image:

Clicking the add '' symbol in an existing Partition Value cell or changing the PK value of a new or existing Partition will move or create Items in the specified Partition.

Changing the "type" attribute value will cause the Item to be annoted with attributes from the corresponding Item template:

Clicking the add '' symbol in a Sort Key value cell will add a new attribute to the Item. When new attribtes are added to an existing Item the Attribute Name becomes editable:

When the attribute name is assigned, all objects of that type will be annotated with the new attribute:

The modeler uses custom code to maintain an editable HTML Table, and there are probably a few bugs that still need to be worked out. If you edit a model and something goes wrong you can hit the back arrow in the Attributes area of the Table header to undo up to 50 changes.

Item Types

All Items created by the DynamoDB Data Modeler have a "type" attribute added automatically, and the modeler maintains an attribute template for each unique Item type detected. As new Items are added to the tool they will inherit the template attributes for the specified Item type, and adding an attribute to any object will also update the template for that object type as well as cause other Items of that type to be annotated with the new attribute.

Context Menus

Every attribute on the table has a Context Menu that can be accessed via right click on the attribute value. The options available on the context menu differ depending on whether the attribute is the Partion Key, Sort Key, or generic.

Partition Key Menu

The Partition Key Context Menu contains the following options:

  1. Add Item - Adds a new Item to the partition.
  2. Paste Item - Adds a copied Item to the partition.
  3. Delete Partition - Deletes all Items in this partition from the table.
  4. Edit Mapping - Define a Mapping Function to generate the Partition Key value.
  5. Move Up/Down - Change the position of the partition on the table.

Sort Key Menu

The Sort Key Context Menu contains the following options:

  1. Add Attribute - Adds a new Attribute to the Item.
  2. Cut Item - Removes the Item from the Table and copies it to the clipboard.
  3. Copy Item - Copies the Item to the clipboard.
  4. Delete Item - Removes the Item from the Table.
  5. Edit Mapping - Define a Mapping Function to generate the Sort Key value.
  6. Generate Value - Inserts either an ISO Date or UUID string as the Sort Key value.

Attribute Menu

The Attribute Context Menu contains the following options:

  1. Delete Attribute - Removes the Attribute from the Item.
  2. Cut Item - Removes the Item from the Table and copies it to the clipboard.
  3. Edit Mapping - Define a Mapping Function to generate the Attribute value.
  4. Generate Value - Inserts either an ISO Date or UUID string as the Attribute value.

Mapping Functions

Attributes can be assigned Mapping Functions to generate their Associated values. Mapping Functions are associated to Attributes by Item type. When an Item is created or modified the type of the Item will determine any Mapping Functions that should be used to generate Attribute values. When the 'Edit Mapping' option is selected the following modal dialogue will appear:

Currently the only operation supported for Mapping Functions is concatenation of other Attributes into a composite key. To combine Attribute values simply reference the attribute name as shown in the screenshot. Any text outside of the '${}' syntax will appear as typed in the final value.

OneTable Integration

If you use OneTable you can now import your schema files into the DynamoDB Datamodel using the convenient link on the Side Panel menu. Simply paste your JSON OneTable Schema into the dialog and you will be able to create Items using the Entity types defined in the OneTable schema. When creating items, set the "type" attribute to the entity type to populate all the other entity attributes. Currently only Table and Entity schema are imported, value mappings are not yet supported.

That should be enough to get you going. Click the '☰ menu' icon in the upper right corner to import an existing model from NoSQL Workbench for DynamoDB or use the modeler to build a data model for your DynamoDB Table from scratch.

Have ideas or feature requests? Ping me on Twitter and let me know!