Working with Table Scans

The Scan API which can be invoked using the scan CLI command. Scan will do a full table scan and return the items in 1MB chunks.

The Scan API is similar to the Query API except that since we want to scan the whole table and not just a single Item Collection, there is no Key Condition Expression for a Scan. However, you can specify a Filter Expression which will reduce the size of the result set (even though it will not reduce the amount of capacity consumed).

Let us look at the data in the Reply table which has both a Partition Key and a Sort Key. Select the left menu bar Item explorer. You may need to click the hamburger menu icon to expand the left menu if its hidden.

Console Menu Hamburger Icon

Console Menu Item Explorer

Once you enter the Item explorer you might need to click the > button to expand the Tables list

Item Explorer Expand Tables

And then choose the Reply table.

For example, we could find all the replies in the Reply that were posted by User A.

Item Explorer Scan Reply 1

You should see 3 Reply items posted by User A.

Exercise

Explore the data in the Forum table and write a scan command to return only the Forums that have more than 1 thread and more than 50 views.

Hint: Read about Reserved Words in DynamoDB and how to deal with situations where one of your attribute names is a reserved word.

The solution is expandable below but try to figure it out yourself before moving forward.

Click below to expand and see the exercise solutions

Expand this to see the solution