Supported Data Types
This page provides details on the data types used within KDB.AI tables, including name, range/example, brief description, and usage.
In KDB.AI, tables are fundamental structures for storing and organizing data. A schema is a list of column definitions that defines the structure of a table. Each column holds data of a specific type, such as integers, symbols, or dates.
Here’s a list of supported data types (scalar and list) in KDB.AI tables:
Datatype |
q Type (scalar/list) |
JSON Type (scalar/list) |
Python (scalar/list) |
Example/Range |
Description |
Usage |
---|---|---|---|---|---|---|
boolean |
b / B |
boolean / booleans |
bool / bools |
true, false |
Represents true or false values |
Used for binary conditions and flags |
byte |
x / X |
byte / bytes |
uint8 / uint8s |
0 to 255 |
8-bit unsigned integer |
Used for raw binary data |
char |
c / C |
char / chars |
char / bytes |
'a', 'b', 'c' |
Single character |
Used for single character data |
date |
d / D |
date / dates |
datetime64[D] / datetime64[D]s |
2024.10.30 |
Calendar date |
Used for date-specific data |
float |
f / F |
float / floats |
float64 / float64s |
3.14, 2.718 |
Double-precision floating-point number |
Used for high-precision numerical data |
guid |
g / G |
guid / guids |
guid / guids |
123e4567-e89b-12d3-a456-426614174000 |
Globally unique identifier |
Used for unique identification |
int |
i / I |
int / ints |
int32 / int32s |
-2147483648 to 2147483647 |
32-bit signed integer |
Used for general integer data |
long |
j / J |
long / longs |
int64 / int64s |
-9223372036854775808 to 9223372036854775807 |
64-bit signed integer |
Used for large integer data |
minute |
u / U |
minute / minutes |
timedelta64[m] / timedelta64[m]s |
12:34 |
Time duration in minutes |
Used for time intervals |
month |
m / M |
month / months |
datetime64[M] / datetime64[M]s |
2024.10 |
Year and month |
Used for monthly data |
real |
e / E |
real / reals |
float32 / float32s |
3.14, 2.718 |
Single-precision floating-point number |
Used for numerical data with less precision |
second |
v / V |
second / seconds |
timedelta64[s] / timedelta64[s]s |
12:34:56 |
Time duration in seconds |
Used for time intervals |
short |
h / H |
short / shorts |
int16 / int16s |
-32768 to 32767 |
16-bit signed integer |
Used for smaller integer data |
symbol |
s / S |
symbol / symbols |
str |
|
Interned string |
Used for categorical data |
time |
t / T |
time / times |
timedelta64[ms] / timedelta64[ms]s |
12:34:56.789 |
Time of day with millisecond precision |
Used for time-specific data |
timestamp |
p / P |
timestamp / timestamps |
datetime64[ns] / datetime64[ns]s |
2024.10.30T12:34:56.789 |
Date and time with nanosecond precision |
Used for precise date-time data |
timespan |
n / N |
timespan / timespans |
timedelta64[ns] |
1234567890ns |
Time duration with nanosecond precision |
Used for high-precision time intervals |
Database types and JSON formats
For data ingestion, use the corresponding JSON formats for database types as below:
Database type ID |
Database type name |
JSON data format |
Description |
Example |
---|---|---|---|---|
-1h |
boolean |
|
A Boolean literal of |
|
-2h |
guid |
|
A 36 character UUIDv4 formatted String |
|
-4h |
byte |
|
A 2 character hex string |
|
-5h |
short |
|
A 16 bit number |
|
-6h |
int |
|
A 32 bit number |
|
-7h |
long |
|
A 64 bit number |
|
-8h |
real |
|
A 32 bit floating point number |
|
-9h |
float |
|
A 64 bit floating point number |
|
-10h |
char |
|
A string of a single character |
|
-11h |
symbol |
|
A string representing a symbol |
|
-12h |
timestamp |
|
A ISO date-time without an offset in format |
|
-13h |
month |
|
A string representing a month in format |
|
-14h |
date |
|
A string representing an ISO Date without an offset in format |
|
-15h |
datetime |
|
A ISO date-time without an offset in format |
|
-16h |
timespan |
|
A duration of time with units in nanoseconds |
|
-17h |
minute |
|
A duration of time in |
|
-18h |
second |
|
A duration of time in |
|
-19h |
time |
|
A duration fo time in |
|
1h |
booleans |
|
Array of boolean values |
|
2h |
guids |
|
Array of guid values |
|
4h |
bytes |
|
Array of byte values |
|
5h |
shorts |
|
Array of short values |
|
6h |
ints |
|
Array of int values |
|
7h |
longs |
|
Array of long values |
|
8h |
reals |
|
Array of real values |
|
9h |
floats |
|
Array of float values |
|
10h |
string |
|
A string of text |
|
11h |
symbols |
|
Array of symbol values |
|
12h |
timestamps |
|
Array of timestamp values |
|
13h |
months |
|
Array of month values |
|
14h |
dates |
|
Array of date values |
|
15h |
datetimes |
|
Array of datetime values |
|
16h |
timespans |
|
Array of timespan values |
|
17h |
minutes |
|
Array of minute values |
|
18h |
seconds |
|
Array of second values |
|
19h |
times |
|
Array of time values |
|