You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enter `PostedBy` as the Partition key, `ReplyDateTime` as the Sort key, and `PostedBy-ReplyDateTime-gsi` as the Index name. Leave the other settings as defaults and click `Create Index`. Once the index leaves the `Creating` state you can continue on to the exercise below.
20
20
@@ -34,11 +34,11 @@ The solution is expandable below but try to figure it out yourself before moving
34
34
35
35
Even if the table has a billion **Reply** items authored by other Users, this query will only cost us to read the exact 3 items we're hoping to return (unlike a `Scan`).
We can see visually that the table has a Partition Key of *Id* (which is the `Number` type), no sort key, and there are 8 items in the table. Some items are Books and some items are Bicycles and some attributes like *Id*, *Price*, *ProductCategory*, and *Title* exist in every Item while other Category specific attributes like Authors or Colors exist only on some items.
16
16
17
17
Click on the *Id* attribute `101` to pull up the Item editor for that Item. We can see and modify all the attributes for this item right from the console. Try changing the *Title* to "Book 101 Title New and Improved". Click **Add new attribute** named *Reviewers* of the String set type and then clicking **Insert a field** twice to add a couple of entries to that set. When you're done click **Save changes**
You can also use the Item editor in DynamoDB JSON notation (instead of the default Form based editor) by clicking **JSON** in the top right corner. This notation should look familiar if you already went through the [Explore the DynamoDB CLI](/hands-on-labs/explore-cli.html) portion of the lab. The DynamoDB JSON format is described in the [DynamoDB Low-Level API](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.LowLevelAPI.html) section of the Developer Guide.
Copy file name to clipboardExpand all lines: content/hands-on-labs/explore-console/console-read-item-collection.en.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,29 +16,34 @@ The Key Condition Expression will define the number of RRUs or RCUs that are con
16
16
We can optionally also specify a [Filter Expression](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html#Query.FilterExpression) for our Query. If we were comparing this to SQL, we would say "this is the part of the WHERE clause that acts on the non-Key attributes". Filter Expressions act to remove some items from the Result Set returned by the Query, **but they do not affect the consumed capacity of the Query**. If your Key Condition Expression matches 1,000,000 items and your FilterExpression reduces the result set down to 100 items, you will still be charged to read all 1,000,000 items. But the Filter Expression reduces the amount of data returned from the network connection so there is still a benefit to our application in using Filter Expressions even if it doesn't affect the price of the Query.
17
17
18
18
The ProductCatalog table we used in the previous examples only has a Partition Key so let's look at the data in the **Reply** table which has both a Partition Key and a Sort Key. Select the left menu bar **Explore items** under Tables.
19
-

19
+
20
+
:image[Console Menu Item Explorer]{src="/static/images/hands-on-labs/explore-console/console_menu_explore_item.png"disableZoom=truewidth=300}
21
+
20
22
You may need to click the hamburger menu icon to expand the left menu if its hidden.
21
-

23
+
24
+
:image[Console Menu Hamburger Icon]{src="/static/images/hands-on-labs/explore-console/console_menu_hamburger_icon.png"disableZoom=truewidth=900}
22
25
23
26
24
27
Once you enter the Explore Items you need to select the **Reply** table and then expand the Scan/Query items box.
25
28
26
-

29
+
:image[Item Explorer Expand Tables]{src="/static/images/hands-on-labs/explore-console/console_explore_item_select_table.png"disableZoom=truewidth=900}
27
30
28
31
29
32
Data in this table has an Id attribute which references items in the Thread table. Our data has two threads, and each thread has 2 replies. Let's use the *Query* functionality to read just the items from thread 1 by pasting `Amazon DynamoDB#DynamoDB Thread 1` into the *Id (Partition key)* box and then clicking **Run**.
30
33
31
34
We can see that there are two Reply items in the `DynamoDB Thread 1` thread.
32
35
33
-

36
+
:image[Item Explorer Query Reply 1]{src="/static/images/hands-on-labs/explore-console/console_item_explorer_query_reply_1.png"disableZoom=truewidth=900}
37
+
34
38
35
39
Since the Sort Key in this table is a timestamp, we could specify a Key Condition Expression to return only the replies in a thread that were posted after a certain time by adding a sort key condition where `ReplyDateTime` is More than `2015-09-21` and clicking **Run**.
36
40
37
-

41
+
:image[Item Explorer Query Reply 2]{src="/static/images/hands-on-labs/explore-console/console_item_explorer_query_reply_2.png"disableZoom=truewidth=900}
38
42
39
43
Remember we can use Filter Expressions if we want to limit our results based on non-key attributes. For example, we could find all the replies in Thread 1 that were posted by User B. Clear the sort key condition, and click **Add filter** then use `PostedBy` for the Attribute name, Condition `Equals` and Value `User B`, then click **Run**.
40
44
41
-

45
+
:image[Item Explorer Query Reply 3]{src="/static/images/hands-on-labs/explore-console/console_item_explorer_query_reply_3.png"disableZoom=truewidth=900}
46
+
42
47
43
48
## Exercise
44
49
@@ -51,6 +56,7 @@ The solution is expandable below but try to figure it out yourself before moving
51
56
::::expand{header="Expand this to see the solution"}
52
57
If we want to order items in descending order of the sort key there are two ways to accomplish this in the console. We could either choose the **Sort descending** checkbox before running the query, or we could run the query and click the arrow next to the *ReplyDateTime* attribute name in the **Items returned** pane to change the sort order on that attribute.
53
58
54
-

59
+
:image[Item Explorer Query Reply 4]{src="/static/images/hands-on-labs/explore-console/console_item_explorer_query_reply_4.png"disableZoom=truewidth=900}
Copy file name to clipboardExpand all lines: content/hands-on-labs/explore-console/console-scan.en.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,18 +9,21 @@ The [Scan API](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/AP
9
9
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](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Scan.html#Scan.FilterExpression) which will reduce the size of the result set (even though it will not reduce the amount of capacity consumed).
10
10
11
11
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 **Explore items**.
12
-

12
+
13
+
:image[Console Menu Item Explorer]{src="/static/images/hands-on-labs/explore-console/console_menu_explore_item.png"disableZoom=truewidth=250}
14
+
13
15
You may need to click the hamburger menu icon to expand the left menu if its hidden.
14
-

16
+
17
+
:image[Console Menu Hamburger Icon]{src="/static/images/hands-on-labs/explore-console/console_menu_hamburger_icon.png"disableZoom=truewidth=900}
15
18
16
19
17
20
Once you enter the Explore Items you need to select the **Reply** table and then expand the Scan/Query items box.
18
21
19
-

22
+
:image[Item Explorer Expand Tables]{src="/static/images/hands-on-labs/explore-console/console_explore_item_select_table.png"disableZoom=truewidth=900}
20
23
21
24
For example, we could find all the replies in the Reply that were posted by User A.
22
25
23
-

26
+
:image[Item Explorer Scan Reply 1]{src="/static/images/hands-on-labs/explore-console/console_item_explorer_scan_reply_1.png"disableZoom=truewidth=900}
24
27
25
28
You should see 3 **Reply** items posted by User A.
26
29
@@ -35,5 +38,6 @@ The solution is expandable below but try to figure it out yourself before moving
35
38
::::expand{header="Expand this to see the solution"}
36
39
For this access pattern we will need to make a FilterCondition with clauses on both the *Threads* and *Views* attributes before clicking **Run**.
37
40
38
-

41
+
:image[Item Explorer Scan Reply 2]{src="/static/images/hands-on-labs/explore-console/console_item_explorer_scan_reply_2.png"disableZoom=truewidth=900}
Copy file name to clipboardExpand all lines: content/hands-on-labs/explore-console/console-writing-data.en.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ The DynamoDB [PutItem API](https://docs.aws.amazon.com/amazondynamodb/latest/API
10
10
11
11
Let's say we wanted to insert a new item into the *Reply* table from the console. First, navigate to the **Reply** table click the **Create Item** button.
@@ -33,7 +33,7 @@ The DynamoDB [DeleteItem API](https://docs.aws.amazon.com/amazondynamodb/latest/
33
33
34
34
You can easily modify or delete an item using the console by selecting the checkbox next to the item of interest, clicking the **Actions** dropdown and performing the desired action.
@@ -47,17 +47,17 @@ The solution is expandable below but try to figure it out yourself before moving
47
47
48
48
Navigate to the **ProductCatalog** Table and click the `Id` 201 hyperlink to bring up the Item Editor for that item. Click the `+` icon next to the *Color* attribute to expand that List.
Return to the item editor for `Id` 201 and use the `Remove` button next to the Silver and Green list entries to remove them from the `Color` attribute, then click `Save changes`.
@@ -27,7 +27,7 @@ You can use your own account, or an account provided through Workshop Studio Eve
27
27
28
28
If you are running this workshop using a link provided to you by your AWS instructor, please use that link and enter the access-code provided to you as part of the workshop. In the lab AWS account, the Visual Studio Code instance should already be provisioned. This should be available at the "Event Output" section in your Workshop studio URL.
0 commit comments