Querying a DynamoDB Table

Lab Steps

lock
Logging in to the Amazon Web Services Console
lock
Creating a DynamoDB Table with a Partition Key
lock
Creating a DynamoDB Table with Local and Global Secondary Indexes
lock
Inserting Items Into a DynamoDB Table
lock
Editing DynamoDB Table Items
lock
Querying a DynamoDB Table
lock
Deleting a DynamoDB Table
Need help? Contact our support team

Here you can find the instructions for this specific Lab Step.

If you are ready for a real environment experience please start the Lab. Keep in mind that you'll need to start from the first step.

Introduction

DynamoDB provides two commands for searching data on the table: scan and query. A scan operation examines every item on the table and returns all the data attributes for each one of them. When you initially navigate to the Items tab for a table, a scan is performed by default.

In this lab step, you will practice querying a table.

 

Instructions 

1. In the left-hand menu, click PartiQL editor:

alt

The PartiQL editor page will load.

PartiQL is a SQL (Structured Query Language) compatible language for Amazon DynamoDB. As well as querying tables, you can use it to insert new items and update existing ones.

 

2. Under Tables, click the three dots next to the   and click Scan table:

alt

The Query 1 editor will be populated with a PartiQL query that selects all items from the  .

 

3. To execute the PartiQL table, under the editor, click Run:

alt

 

4. Scroll down to see the results under Items returned:

alt

Notice that you have a choice of viewing the results in tabular form or in JSON (Java Script Object Notation):

alt

 

5. To query for a specific item, replace the contents of the Query 1 editor with the following, and click Run:

Copy code
1
SELECT * FROM "Thread" WHERE "Subject" = 'Intro to cool stuff'

This time, you will only see items returned that satisfy the value of the WHERE condition.

Note: Change the value of the WHERE condition to match an item you created if you don't see a result.

PartiQL supports most standard features of SQL which means you can query, select, and sort your data in sophisticated ways.

Typically, using the Amazon DynamoDB Console to query items is useful for one-off reports and debugging or troubleshooting. Like most databases, DynamoDB can be accessed programmatically by other systems and software applications through either the AWS SDK (software development kit) or DyanmoDB's HTTP API (application programming interface).

You can learn more about using PartiQL with Amazon DynamoDB by visiting the Working with PartiQL Query Language section of the Amazon DynamoDB developer guide.

 

Summary

In this lab step, you practiced using the DynamoDB dashboard to query a table.