What are facets in NoSQL Workbench for Amazon DynamoDB

Kirk Kirkconnell
Oct 18 · 3 min read
Photo by Yuri Bodrikhin on Unsplash

In NoSQL Workbench for Amazon DynamoDB, there is a section of functionality called facets that can be of benefit to any data modeling exercise for DynamoDB. As part of a single table design, which is considered a best practice for data modeling in DynamoDB, that overall design can become visually complicated to human eyes. Facets were developed in NoSQL Workbench to assist users in modeling each item type in its own vista in the tool so they can work with just those items and not the entire table when modeling an application’s access patterns. The concept of a facet can be confusing to some, so let’s look at an example.

In the screen shot below, we are looking at the “Aggregate view” of a table in the Workbench tool of a retail products data model. The aggregate view is ordered by partition ID and then arranged by sort key. It is a single table design, but this example has only a tiny bit of data in it. You can see there are a few different types of items in the table, but when you add more data, this view would most likely get messy for a human to look at.

What if you only want to look at the items for the store’s products in this table? In the aggregate view, you cannot do that.

In the workbench visualizer section, if you define a facet and then add data to it, you see the facets for a table. Below is an example of a facet for just the products on the table without any other item types.

Note: At the time of this post, creating a facet in the Workbench tool is a manual process you have to perform in JSON. Once you do that, then you can use the tool to add data in the facet. This tool is a preview.

In the planning stages of designing a data model, it is very useful to be able to work with just a subset of data you want to model and not the entire table. We could call a facet a view of the DynamoDB table, but the word view has special meaning in databases, so it should be avoided. Facets exist purely to help you visually see just the sub-set of data from the table you are interested in at the moment when you are modeling your access patterns. One critical thing to know is that a facet is a virtual construct of the NoSQL Workbench tool, not a functional construct in DynamoDB itself.

So if that helps, think about a facet as one side of a cube and that cube is a single DynamoDB table. It is still the same cube regardless of how you turn it, but what if we only want to explore one side at a time?

Bonus fact: if you look at the icon for the NoSQL workbench tool, there is a reason it looks like a cube on its point. It is to represent the facets of tables.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade