Database Reference
In-Depth Information
Chapter 2. Data Models
The flexibility of any database depends on the architecture and design of its data models. A
data model fundamentally decides how data is stored, organized, and can be manipulated.
When it comes to typical a RDBMS, we tend to provide the information in terms of hier-
archical, relational, and network data models. SQL was designed to interact with an end
user assuming he/she will use SQL to run queries that would aggregate data at one place,
giving all information together. But it takes a lot of effort to maintain this user-oriented ap-
proach. Later, people realized that most of the time is being spent on creating database
schemas, maintaining referential integrity, and providing transactional guarantees even
though they are not using these things much. This thought ultimately resulted in the imple-
mentation of schema-less, relation-free databases, that is, NoSQL databases.
Relational data modeling starts with all the data that you have and the answers you can
provide with data, whereas NoSQL data modeling is application oriented. Here, we create
tables and decide on our columns, which directly solves the application-specific problem.
NoSQL data modeling requires better understanding of the problem that you are trying to
solve with your application.
In the previous chapter, we have seen a glimpse of DynamoDB data models. There, we dis-
cussed tables, items, and attributes. In this chapter, we are going to talk about how to pro-
grammatically create, update, and delete tables, items, and attributes. We are also going to
discuss the primary keys used in DynamoDB, intelligently choosing hash and range keys
for better performance, and the data types that are available.
For better understanding of DynamoDB, we have divided this chapter into the following
parts:
• Primary keys
• Data types
• Operations
Just to understand in a better manner, let's see what tables, items, and attributes look like.
Consider an example of a bookstore where we have multiple entities, such as topics ,
Authors , and Publishers , and so on. So, to understand the DynamoDB data model in
a better way, please have a look at the following diagram that shows how a Book table
would look:
Search WWH ::




Custom Search