Data Types In DynamoDB
Main Data Types in DynamoDB
DynamoDB data type 3 ভাগে ভাগ করা যায়:
1️⃣ Scalar Types (Single Value)
| Type | Description | Example |
|---|---|---|
| S | String | "Ali" |
| N | Number (Integer, Float, Decimal) | 24 , 99.99 |
| B | Binary | Binary data, e.g., images encoded as bytes |
| BOOL | Boolean | true / false |
| NULL | Null | Represents missing or empty value |
Scalar types = একবারে single value hold করে
2️⃣ Document Types (Complex Data)
| Type | Description | Example |
|---|---|---|
| M | Map (JSON Object) | { "street": "Dhanmondi", "city": "Dhaka" } |
| L | List (Array) | [ "coding", "football", "music" ] |
Document types = Multiple values, structured data, JSON-like
3️⃣ Set Types (Unique Collections)
| Type | Description | Example |
|---|---|---|
| SS | String Set | [ "apple", "banana", "mango" ] (unique strings) |
| NS | Number Set | [ 1, 2, 5, 7 ] (unique numbers) |
| BS | Binary Set | [ <binary1>, <binary2> ] (unique binaries) |
Set types = Unique items, unordered collection
Example – JSON Representation
{
"user_id": {"S": "1"},
"name": {"S": "Ali"},
"age": {"N": "24"},
"is_active": {"BOOL": true},
"hobbies": {"L": ["coding","football","music"]},
"address": {"M": {"street":"Dhanmondi","city":"Dhaka"}},
"tags": {"SS": ["VIP","Premium"]}
}
✅ এভাবে সব data types mix করে রাখা যায়।
Professional Notes
DynamoDB schema-flexible, তাই primary key ছাড়া attribute type constraint নেই।
Number type (N) = সব numeric (integer, float) একসাথে handle করে।
Boolean & Null = lightweight flag / empty value।
List & Map = JSON style, embedded documents possible।
Set types = relational DB এর UNIQUE constraint এর মতো behaviour।