DynamoDB – Tables, Items, and Attributes
In DynamoDB the Tables, Items, and Attributes are among the core components, and we will be discussing them in detail in this article.
A table in DynamoDB is a collection of items. The key factors that make it unique are listed below:
- Dynamodb stores data in a table which is nothing but a collection of data.
- These tables have no schema
- An initial limit of 256 tables per region is applied.
Items in DynamoDB are a collection of attributes which uniquely identify an item among all of the other items. The fundamental data element of DynamoDB.
- It uses Primary keys to identify every item in the table and the secondary indexes to allow more flexible querying.
- A table can have multiple or zero items.
Attributes are the fundamental data element of DynamoDB. All items comprise one or more attributes. As being the fundamental data element attributes cannot be further broken down. Attributes in DynamoDB are similar in many ways to fields or columns in other database systems.
Now let’s look below for an example depicting a sample database of People:
In the above example image,
- People table comprises of 3 items.
- Each item have 3 attributes namely, LastName, FirstName and Age.
- Each item has a primary key namely, PersonID.
Notice the below points in the above diagram:
- 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, the primary key consists of one attribute (PersonID).
- Other than the primary key, the People table is schemaless, which means that neither the attributes nor their data types need to be defined beforehand. Each item can have its own distinct attributes.
- Most of the attributes are scalar, which means that they can have only one value. Strings and numbers are common examples of scalars.