AWS News Blog

DynamoDB Update – Improved JSON Editing & Key Condition Expressions

Thousands of customers use Amazon DynamoDB to build popular applications for Gaming (Battle Camp), Mobile (The Simpsons Tapped Out), Ad-tech (AdRoll), Internet-of-Things (Earth Networks) and Modern Web applications (SmugMug).

We have made some improvements to DynamoDB in order to make it more powerful and easier to use. Here’s what’s new:

  1. You can now add, edit, and retrieve native JSON documents in the AWS Management Console.
  2. You can now use a friendly key condition expression to filter the data returned from a query by specifying a logical condition that must be met by the hash or hash range keys for the table.

Let’s take a closer look!

Native JSON Editing
As you may know, DynamoDB already has support for storage, display, and editing of JSON documents (see my previous post, Amazon DynamoDB Update – JSON, Expanded Free Tier, Flexible Scaling, Larger Items if this is news to you). You can store entire JSON-formatted documents (each up to 400 KB) as single DynamoDB items. This support is implemented within the AWS SDKs and lets you use DynamoDB as a full-fledged document store (a very common use case).

You already have the ability to add, edit, and display JSON documents in the console in DynamoDB’s internal format. Here’s what this looks like:

Today we are adding support for adding, editing, and display documents in native JSON format. Here’s what the data from the example above looks like in this format:

You can work with the data in DynamoDB format by clicking on DynamoDB JSON. You can enter (or paste) JSON directly when you are creating a new item:

You can also view and edit the same information in structured form:

Key Condition Expressions
You already have the ability to specify a key condition when you call DynamoDB’s Query function. If you do not specify a condition, all of the items that match the given hash key will be returned. If you specify a condition, only items that meet the criteria that it specifies will be returned. For example, you could choose to retrieve all customers in Zip Code 98074 (the hash key) that have a last name that begins with “Ba.”

With today’s release, we are adding support for a new and easier to use expression-style syntax for the key conditions. You can now use the following expression to specify the query that I described in the preceding paragraph:

      zip_code = "98074" and begins_with(last_name, "Ba")

The expression can include Boolean operators (=, <, <=, >, >=), range tests (BETWEEN/AND), and prefix tests (begins_with). You can specify a key condition (the KeyCondition parameter) or a key condition expression (the KeyConditionExpression parameter) on a given call to the Query function, but you cannot specify both. We recommend the use of expressions for new applications. To learn more, read about Key Condition Expressions in the DynamoDB API Reference.

Available Now
These features are available now and you can start using them today!