Skip to main content

Data types

When you create a BlockDB table, every column declares a logical type. BlockDB validates the data format against the type, maps it to the underlying storage, and returns it as the corresponding Python type in the SDK.

Character types (usable as primary key)

Every character type except HEXSTRING and TEXT can be used as a table’s primary key.

Character types (not usable as primary key or index)

Numeric types

Time types

Boolean type

Composite types (not indexable)

Type usage constraints

  • Primary keys may only use the character types STRING, HASH, ADDRESS, TOKENID, TXID, BLOCKID, CHAINID, DATASET, and LOGO (that is, every character type except HEXSTRING and TEXT).
  • TEXT does not support real-time indexing.
  • HEXSTRING cannot be a primary key and cannot be indexed.
  • JSON, LIST, and DICT cannot be indexed.
  • All character types are represented as str in the SDK. All hex types (HASH, ADDRESS, TOKENID, TXID, BLOCKID, HEXSTRING) are hexadecimal strings at the API boundary; BlockDB validates their length and format and stores them as fixed-length or variable-length bytes.