Database Reference
In-Depth Information
topic SCJP authored by Kathy is first, followed by the topic authored by Khalid. This an-
swers the first question.
An attribute of the type String can hold only a simple string. For example, in the previ-
ous table we have two attributes ( Language and Language2 ) to store the edition lan-
guage of the topic. If a topic has 10 different language editions, then we would be left
with too many attributes in an item (which will reduce fetch efficiency as discussed on the
previous page). So a better solution is to change the Language attribute from a simple
String type to StringSet as shown in the following table:
The same cannot be done for the Author attribute. Can you guess why? If not, you can
go back and take a look at Table 1.9 and Table 1.10. Can you guess now? It's because
neither the hash key nor the range key can be of the Set type.
At present there are only six data types in DynamoDB, namely String , Number , Bin-
ary , StringSet , NumberSet , and BinarySet . We will discuss this at the end of
this chapter.
During table creation, there are two scenarios that decide the mandatory parameters
needed to create a DynamoDB table.
Hash primary key : In this scenario we must (and we can only) provide two para-
meters. The first parameter is the table name, and the second parameter is the
name and type of hash key.
Hash and range primary key : In this scenario, we must (and we can only)
provide three parameters. The first parameter is the table name, the second para-
meter is the name and type of hash key, and the third parameter is the name and
type of range key.
Search WWH ::




Custom Search