DynamoDB - Data Types

DynamoDB - Data Types

The data types supported by DynamoDB include data types specific to attributes, actions, and the chosen coding language.

Attribute data types

DynamoDB supports a large set of data types for table attributes. Each data type falls into one of the following three categories:

  • Scalar. These types represent a single value and include number, string, binary, boolean, and zero.

  • Document - These types are complex structures with nested attributes and include lists and maps.

  • Set - These types represent multiple scalars and include string sets, number sets, and binary sets.

Scalar. These types represent a single value and include number, string, binary, boolean, and zero.

Document - These types are complex structures with nested attributes and include lists and maps.

Set - These types represent multiple scalars and include string sets, number sets, and binary sets.

Think of DynamoDB as a schemaless NoSQL database that doesn't need attribute or data type definitions when creating a table. This only requires the data types of the primary key attribute, unlike RDBMS, which require the data types of the column when the table is created.

Scalars

  • Numbers − They are limited to 38 digits and can be positive, negative or zero.

  • String is Unicode using UTF-8, with a minimum length > 0 and a maximum of 400 KB.

  • Binary - they store any binary data, such as encrypted data, images, and compressed text. DynamoDB treats its bytes as unsigned.

  • Boolean - They store true or false.

  • Null - They represent an unknown or undefined state.

Numbers − They are limited to 38 digits and can be positive, negative or zero.

String is Unicode using UTF-8, with a minimum length > 0 and a maximum of 400 KB.

Binary - they store any binary data, such as encrypted data, images, and compressed text. DynamoDB treats its bytes as unsigned.

Boolean - They store true or false.

Null - They represent an unknown or undefined state.

Document

  • List − Stores collections of ordered values ​​and uses square ([…]) brackets.

  • Map - stores unordered collections of name-value pairs and uses curly ({...}) curly braces.

List − Stores collections of ordered values ​​and uses square ([…]) brackets.

Map - stores unordered collections of name-value pairs and uses curly ({...}) curly braces.

Set

Sets must contain elements of the same type, be it number, string, or binary. The only limits set for sets consist of a 400 KB element size limit, with each element being unique.

Action Data Types

The DynamoDB API contains various data types used by actions. You can view the selection of the following key types −

  • AttributeDefinition - Represents the key table and index schema.

  • Capacity - Represents the amount of throughput consumed by a table or index.

  • CreateGlobalSecondaryIndexAction - Represents a new global secondary index added to the table.

  • LocalSecondaryIndex - Represents the properties of a local secondary index.

  • ProvisionedThroughput - Represents the allocated throughput for an index or table.

  • PutRequest - Represents PutItem requests.

  • TableDescription - Represents the properties of a table.

AttributeDefinition - Represents the key table and index schema.

Capacity - Represents the amount of throughput consumed by a table or index.

CreateGlobalSecondaryIndexAction - Represents a new global secondary index added to the table.

LocalSecondaryIndex - Represents the properties of a local secondary index.

ProvisionedThroughput - Represents the allocated throughput for an index or table.

PutRequest - Represents PutItem requests.

TableDescription - Represents the properties of a table.

Supported Java Data Types

DynamoDB provides support for primitive data types, collection sets, and arbitrary types for Java.