Database Reference
In-Depth Information
Data format
DynamoDB uses the JavaScript Object Notation ( JSON ) format to send the request to,
and receive the response from, the DynamoDB endpoint. One important rule of thumb is
that the DynamoDB endpoint gets this JSON request and parses it into its native format
(which is not JSON). During this time, some data loss might occur because of compatibility
issues. For example, JSON supports the date data type, but DynamoDB does not support
it. So the JSON request should not have a DynamoDB incompatible data type. In order to
avoid this situation, DynamoDB has already listed the allowed data types, and they are as
follows:
S : This denotes the String data type to store strings such as "Kuppu"
N : This denotes the Number data type to store numbers such as 2014
B : This denotes the Binary data type
SS : This denotes the StringSet data type to store string sets such as
{"Uchit", "Vyas"}
NS : This denotes the NumberSet data type to store number sets such as {2013,
2014}
BS : This denotes the BinarySet data type
Tip
Primarily, DynamoDB supports only two data types, namely, the scalar data type and multi-
valued data type. S, N, and B fall under the first category, and the remaining three set types
fall under the second category.
In the following example requests, all the attribute names and values will be placed within
double quotes, which clearly means that all request parameters are sent as a string. So
while sending binary data we need to first encode it with Base64 encoding and pass the en-
coded value as a string. The DynamoDB endpoint parses it by looking at whether it belongs
to any of the previously mentioned data types. If it is proven negative then DynamoDB will
not process this request and will send a response to the client that the JSON or request is in-
valid. I personally advise readers to explore the JSON syntax and its advantages, and then
proceed through the rest of the chapter.
Search WWH ::




Custom Search