Header Ads

Header ADS

Data Types In DynamoDB

Main Data Types in DynamoDB

DynamoDB data type  3  ভাগে ভাগ করা যায়:


1️⃣ Scalar Types (Single Value)

TypeDescriptionExample
SString "Ali"
NNumber (Integer, Float, Decimal)  24 , 99.99
BBinary    Binary data, e.g., images encoded as bytes
BOOL   Boolean  true / false
NULLNull   Represents missing or empty value

Scalar types = একবারে single value hold করে


2️⃣ Document Types (Complex Data)

TypeDescriptionExample
MMap (JSON Object){ "street": "Dhanmondi", "city": "Dhaka" }
LList (Array)[ "coding", "football", "music" ]

Document types = Multiple values, structured data, JSON-like


3️⃣ Set Types (Unique Collections)

Type  DescriptionExample
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

  1. DynamoDB schema-flexible, তাই primary key ছাড়া attribute type constraint নেই।

  2. Number type (N) = সব numeric (integer, float) একসাথে handle করে।

  3. Boolean & Null = lightweight flag / empty value।

  4. List & Map = JSON style, embedded documents possible।

  5. Set types = relational DB এর UNIQUE constraint এর মতো behaviour।


Powered by Blogger.