Tables
DynamoDB stores data in tables. A table is a collection of data.
Items
Each table contains zero or more items. An item is a group of attributes that is uniquely identifiable among all of the other items.
Attributes
Each item is composed of one or more attributes. An attribute is a fundamental data element, something that does not need to be broken down any further.
Note that the items do not have a fixed structure, so the table is schemaless.
Most of the attributes are scalar, which means that they can have only one value. Strings and numbers are common examples of scalars.
Some of the items have a nested attribute (like Address). DynamoDB supports nested attributes up to 32 levels deep.
Keys
Each item in the table has a unique identifier, or primary key, that distinguishes the item from all of the others in the table.
In the People table (previous example), the primary key consists of one attribute (PersonID).
Sometimes, the primary key can be made of two keys.
Here's an example:
1{
2 "Artist": "No One You Know",
3 "SongTitle": "My Dog Spot",
4 "AlbumTitle": "Hey Now",
5 "Price": 1.98,
6 "Genre": "Country",
7 "CriticRating": 8.4
8}
910{
11 "Artist": "No One You Know",
12 "SongTitle": "Somewhere Down The Road",
13 "AlbumTitle": "Somewhat Famous",
14 "Genre": "Country",
15 "CriticRating": 8.4,
16 "Year": 1984
17}
1819{
20 "Artist": "The Acme Band",
21 "SongTitle": "Still in Love",
22 "AlbumTitle": "The Buck Starts Here",
23 "Price": 2.47,
24 "Genre": "Rock",
25 "PromotionInfo": {
26 "RadioStationsPlaying": [
27 "KHCR",
28 "KQBX",
29 "WTNR",
30 "WJJH"
31 ],
32 "TourDates": {
33 "Seattle": "20150622",
34 "Cleveland": "20150630"
35 },
36 "Rotation": "Heavy"
37 }
38}
3940{
41 "Artist": "The Acme Band",
42 "SongTitle": "Look Out, World",
43 "AlbumTitle": "The Buck Starts Here",
44 "Price": 0.99,
45 "Genre": "Rock"
46}
The primary key for Music consists of two attributes (Artist and SongTitle).
Each item in the table must have these two attributes. The combination of Artist and SongTitle distinguishes each item in the table from all of the others.
When a table has a primary key made of one attribute, this attribute is the partition key.
When a table has a primary key made of two keys, one is the partition key, and the other is the sort key