From 8f1eeeb708cf587cd12c1d15a0daaf36a05e01f1 Mon Sep 17 00:00:00 2001 From: mparnisari Date: Fri, 21 Jul 2023 23:52:07 -0700 Subject: [PATCH] various fixes --- content/lessons/advanced-topics/secondary-indexes.md | 2 +- .../data-modeling-examples/hierarchical-data.md | 2 +- content/lessons/data-modeling-examples/overview.md | 10 +++++----- content/lessons/multi-item-actions/filtering.md | 4 ++-- content/lessons/multi-item-actions/scans.md | 2 +- content/lessons/resources/additional-reading.md | 4 ++-- .../lessons/single-item-actions/anatomy-of-an-item.md | 2 +- content/lessons/single-item-actions/inserting-items.md | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/content/lessons/advanced-topics/secondary-indexes.md b/content/lessons/advanced-topics/secondary-indexes.md index b6e60d7..903b4f9 100644 --- a/content/lessons/advanced-topics/secondary-indexes.md +++ b/content/lessons/advanced-topics/secondary-indexes.md @@ -31,7 +31,7 @@ There are a few basics of secondary indexes that are worth knowing: - **No uniqueness requirement**. Recall that for a table's primary key, _every item is uniquely identified by its primary key_. Thus, you can't have two Items with the same key in a table. - This requirement is not applicable to secondary indexes. You may have Items in your secondary index with the exact same key structure. + This requirement is not applicable to secondary indexes. You may have Items in your secondary index with the exact same key structure. This explains why you can't call GetItem or BatchGetItem on an index: there could be more than one result. - **Secondary index attributes aren't required.** When writing an Item, you _must_ specify the primary key elements. This isn't true with secondary indexes -- you may write an Item that doesn't include the attributes for secondary indexes. If you do this, the Item won't be written to the secondary index. This is known as a _sparse index_ and can be a very useful pattern. diff --git a/content/lessons/data-modeling-examples/hierarchical-data.md b/content/lessons/data-modeling-examples/hierarchical-data.md index 47ad022..3be2944 100644 --- a/content/lessons/data-modeling-examples/hierarchical-data.md +++ b/content/lessons/data-modeling-examples/hierarchical-data.md @@ -102,7 +102,7 @@ Our first query pattern was to "Retrieve a single store by its Store Number." We Because our table's primary key is Store Number, we can use the familiar [GetItem](./inserting-retrieving-items#get-item) API call to retrieve a single Item based on its primary key. -Run the [`get_store_location`](https://github.com/alexdebrie/dynamodbguide.com/tree/master/examples/starbucks/get_store_location.py) script provided in the repo. By default, it will use our default Store Number: +Run the [`get_store_location`](https://github.com/alexdebrie/dynamodbguide.com/tree/master/examples/starbucks/get_store_location.py) script provided in the repo. By default, it will use our default Store Number: "5860-29255" It should print out the details for our retrieved Item: diff --git a/content/lessons/data-modeling-examples/overview.md b/content/lessons/data-modeling-examples/overview.md index 6c6e1c7..7d7386a 100644 --- a/content/lessons/data-modeling-examples/overview.md +++ b/content/lessons/data-modeling-examples/overview.md @@ -14,15 +14,15 @@ This chapter is intended to grow over time. Are there particular use cases you'd ### Available examples: -- [**Building a global leaderboard using write sharding**](./leaderboard-write-sharding) +- [**Modeling hierarchical data***](./hierarchical-data) + + This example shows how to model hierarchical data. **It includes a full code sample that uses >25,000 Starbucks store locations.** Learn how to satisfy multiple access patterns, including finding all stores in a particular state, all stores in a particular city, and all stores in a particular zip code. + + - [**Building a global leaderboard using write sharding**](./leaderboard-write-sharding) Learn how to organize your DynamoDB to allow for leaderboard-like queries -- "What are the most-viewed items in my table?" "Which users have the top score in my game?" You will also learn how to use write-sharding and scatter-gather queries to alleviate write throttling for high-usage keys. - -- [**Modeling hierarchical data***](./hierarchical-data) - - This example shows how to model hierarchical data. **It includes a full code sample that uses >25,000 Starbucks store locations.** Learn how to satisfy multiple access patterns, including finding all stores in a particular state, all stores in a particular city, and all stores in a particular zip code. ### Planned examples: diff --git a/content/lessons/multi-item-actions/filtering.md b/content/lessons/multi-item-actions/filtering.md index 5f3d767..dfbb98d 100644 --- a/content/lessons/multi-item-actions/filtering.md +++ b/content/lessons/multi-item-actions/filtering.md @@ -13,9 +13,9 @@ Filter expressions are used to apply server-side filters on Item attributes _bef ## Breakdown of a DynamoDB API Call -For the DynamoDB Query and Scan operations, there are three separate steps happening on the DynamoDB server: +For the DynamoDB Query and Scan operations that have a `Limit` parameter, there are three separate steps happening on the DynamoDB server: -1. **Retrieve** the requested data. This step looks at Starting Token (if provided) for both types of operations, and the Key Expression in a Query operation. +1. **Retrieve** up to `Limit` items. This step looks at Starting Token (if provided) for both types of operations, and the Key Expression in a Query operation. 2. (Optionally) **Filter** the data retrieved in step 1. This includes applying filters as described in this section or projection expressions as discussed in previous lessons. diff --git a/content/lessons/multi-item-actions/scans.md b/content/lessons/multi-item-actions/scans.md index bdc8e23..2d53f39 100644 --- a/content/lessons/multi-item-actions/scans.md +++ b/content/lessons/multi-item-actions/scans.md @@ -166,6 +166,6 @@ You can see the response only has 11 items, rather than the full 25: } ``` -Segments are zero-indexed, though I had trouble when trying to use Segment "0" with DynamoDB Local -- it kept returning 0 elements. +Segments are zero-indexed. Note that [if you are using DynamoDB Local, the Segment and TotalSegments parameters are ignored](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.UsageNotes.html). In the next section, we'll learn about [filtering](./filtering) your Query and Scan operations. diff --git a/content/lessons/resources/additional-reading.md b/content/lessons/resources/additional-reading.md index f893493..d6f7b2b 100644 --- a/content/lessons/resources/additional-reading.md +++ b/content/lessons/resources/additional-reading.md @@ -31,7 +31,7 @@ type: "lesson" - [Awesome DynamoDB](https://github.com/alexdebrie/awesome-dynamodb) -- A GitHub repo with DynamoDB links and resources. - [DynamoDB landing page](https://aws.amazon.com/dynamodb/) - [AWS Developer Guide Docs](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Introduction.html) -- [AWS CLI reference for DynamoDB](https://docs.aws.amazon.com/cli/latest/reference/dynamodb/index.html) +- [AWS CLI reference for DynamoDB](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dynamodb/index.html) - [Boto3 (Python client library for AWS) docs](http://boto3.readthedocs.io/en/latest/reference/services/dynamodb.html) -- [Javascript client library for AWS](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html) +- [Javascript client library for AWS](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/) - [Document Client cheat sheet (Javascript)](https://github.com/dabit3/dynamodb-documentclient-cheat-sheet). Created by [Nader Dabit](https://twitter.com/dabit3). diff --git a/content/lessons/single-item-actions/anatomy-of-an-item.md b/content/lessons/single-item-actions/anatomy-of-an-item.md index 92ff616..9918336 100644 --- a/content/lessons/single-item-actions/anatomy-of-an-item.md +++ b/content/lessons/single-item-actions/anatomy-of-an-item.md @@ -7,7 +7,7 @@ date: "1/1/2018" type: "lesson" --- -An _item_ is the core unit of data in DynamoDB. It is comparable to a row in a relational database, a document in MongoDB, or a simple object in a programming language. Each item is _uniquely identifiable_ by a primary key that is set on a table level. +An _item_ is the core unit of data in DynamoDB. It is comparable to a row in a relational database, a document in MongoDB, or a simple object in a programming language. Each item is _uniquely identifiable_ by a primary key that is set on a table level. Each item cannot exceed 400KB in size. An item is composed of _attributes_, which are bits of data on the item. This could be the "Name" for a User, or the "Year" for a Car. Attributes have types -- e.g., strings, numbers, lists, sets, etc -- which must be provided when writing and querying Items. diff --git a/content/lessons/single-item-actions/inserting-items.md b/content/lessons/single-item-actions/inserting-items.md index a09f84f..80cae4c 100644 --- a/content/lessons/single-item-actions/inserting-items.md +++ b/content/lessons/single-item-actions/inserting-items.md @@ -192,7 +192,7 @@ $ aws dynamodb get-item \ Sometimes you may want to retrieve only certain attributes when getting an Item. This can be particularly helpful for saving network bandwidth when working with large items. -Use the `--projection-expression` option to return only particular elements from an item: +Use the `--projection-expression` option to return only particular attributes from an item: ```bash $ aws dynamodb get-item \