
Navigation
- Tutorial Home
- Introduction to DynamoDB database
- DynamoDB local and setups required
- DynamoDB Data types tutorial
- Create a table in DynamoDB
- Insert items into DynamoDB table
- Query items in a DynamoDB table
- Scan the DynamoDB table items
- Update an item in the DynamoDB table
- DynamoDB table Index – Global and local
In this section of the tutorial, we will be learning about the DynamoDB Data types supported.
DynamoDB supports different data types. The data types are mostly categorized into three different types:
- Scalar Types – Exactly one number
- Document Types – complex structure with nested attributes: JSON
- Set Types – multiple scalar values: Array of the same type
Scalar Data Types
Following are the different types supported by DynamoDB:
- Number – 38 digits number is supported. The numbers can be positive or negative. These are sent as a string in DynamoDB while sending via network but for all mathematical operation it is treated as a number
- String – DynamoDB supports UTF-8 format strings. There is no DateTime format in DynamoDB so the string can be used for this propose. The size of the string can max 400KB which is the item size limit of DynamoDB. For primary key, the max length can be 2048 bytes whereas the sort key can be 1024bytes.
- Binary – Binary data like images, compressed texts are supported. Same as the string can max 400KB. Also similar to string primary key 2048bytes and sort key 1024bytes length is supported.
- Boolean – True/False value
- null – null value
Document Types
There are two document types:
- List(array) – List data type or array is supported by DynamoDB. The elements are unsorted. We can store any kind of data type in a list.
eg;Learn: ["Golang", "DynamoDB", 12]
- map(JSON) – map is JSON type key-value data type. We can store any nested JSON value here. We cannot query in the nested JSON. Any kind of value can be saved in a JSON.
eg:{ "Data": 123, "Value": "integer", meta: { "length": 3 } }
Set Types
The set type is similar to a list. Set type support only a single type of Data type as an element. The limit of the set type is 400kb. It is not an ordered set. There are three set types:
- string set – Only string
["hello", "world"]
- number set – Only numbers
[1, 2, 3]
- binary set – Only binary values
In the next section of the tutorial, we will be learning about how we can create tables.