Database Reference
In-Depth Information
Scalar data types
Scalar data types are simply single-value, simple data types. DynamoDB supports the fol-
lowing three scalar data types:
• String
• Number
• Binary
String
The string is a multipurpose, useful data type that is similar to what we use in various pro-
gramming languages. DynamoDB strings support UTF-8 binary encoding. DynamoDB
does not put restrictions on the string size limit, but it specifies that the total attribute size
should not be greater than 64 KB and we already know that attribute value is calculated
considering the attribute name (key) plus attribute value together. When it comes to ordered
query results, DynamoDB does the comparison using ASCII character code value, which
means smaller letters (a,b,c,...) are greater than capital letters (A,B,C,…). One thing to note
here is that DynamoDB does not allow us to store empty strings, so if you don't have any
value for an attribute for a certain item, it will not add the attribute itself.
Number
The number in DynamoDB is either positive or negative, and it is either an exact-value
decimal or an integer. DynamoDB supports as long as 38-digit precision after decimal point
values to be stored as numbers, which means that DynamoDB supports number values ran-
ging between 10^-128 and 10^+126. When numbers are transferred from one place to oth-
er, serialized numbers are transformed as strings, which gives the benefit of stronger com-
patibility between various languages and libraries. But when it comes to mathematical op-
erations, DynamoDB, as expected, treats them as numbers.
Binary
The binary data type in DynamoDB works like binary large object ( BLOBs ) and charac-
ter large object ( CLOBs ) in the relational database. Once you declare a variable as binary,
you can store binary data like zip files, images, XML files, and so on in it. By default, Dy-
namoDB encodes the given data using the Base64 encoder and then stores it in the table. To
read back the original binary value, you should decode it using the Base64 decoder.
Search WWH ::




Custom Search