Data Types

The Simba DynamoDB JDBC Driver supports many DynamoDB data types, and converts data between DynamoDB and SQL data types as needed. The mapping between each data type is determined by the schema definition, which you can create by using the Schema Editor application that is included with the connector.

Note:

For information about how to use the Schema Editor, see the Schema Editor User Guide for JDBC Connections included in the ZIP file for the connector.

For more information about schema definitions, including the rules that are used to determine how data is mapped and converted between types, see Schema Definition.

The following table lists the default data type mappings that the connector uses.

DynamoDB Type SQL Type Java Type

Binary

SQL_VARBINARY

VarBinary

Boolean

SQL_BIT

Bit

Number

If the value contains a decimal (.), SQL_DOUBLE.

If the value does not contain a decimal (.), SQL_BIGINT. If the value is too large for SQL_BIGINT, then SQL_VARCHAR is used instead.

If the value contains a decimal(.), Double.

If the value does not contain a decimal (.), BigInt. If the value is too large for BigInt, then VarChar.

String

SQL_VARCHAR

VarChar

To support complex DynamoDB data types such as lists and sets, the connector renormalizes the data into virtual tables. For more information, see Virtual Tables.

To support maps, the connector renormalizes the data into columns. For more information, see the following example.

Example of Renormalization for Maps

Consider the following DynamoDB table named ExampleTable, which contains a map column named Info:

Partition Sort StudentNumber Info

0

1

1001231

{{Name: {S: John Doe}}, {Age: {N: 27}}, {Address: {S: 221B Main St.}}}

3

3

1001232

{{Name: {S: Jane Doe}}, {Age: {N: 25}}}

The connector creates a column for each distinct map key that it detects, and saves the columns as part of the schema definition for the table. The columns are named using the name of the map, an underscore (_), and the name of the key. The following table shows ExampleTable after the map data is renormalized:

Partition Sort StudentNumber Info_Name Info_Age Info_Address

0

1

1001231

John Doe

27

221B Main St.

3

3

1001232

Jane Doe

25

Null