Nick The Greek
Nick The Greek

Reputation: 453

How to use ILP data types with QuestDB data types?

I use QuestDb with Influx Line Protocol. When I send new metric QuestDB automatically creates a table and for all my numbers it uses DOUBLE type. Also it can create SYMBOL for Tags and String for other string fields in the message and LONG for numbers ending with 'i'.

So I can send

sensors,location=ny temperature=22,flag=6i,name="out" 1465839830100400200

and it will create

location SYMBOL
temperature DOUBLE
flag LONG
name STRING

How can I control what type is created if I want to have FLOAT instead of DOUBLE or INT, SHORT or BYTE instead of LONG?

Upvotes: 0

Views: 220

Answers (1)

Alex des Pelagos
Alex des Pelagos

Reputation: 1485

Influx Line Protocol does not have necessary granularity of types to cover all QuestDB types. The way to use of different data types is to pre-create the in QuestDB table before sending ILP metrics data. So if you create a table like this

create table abc (
  location SYMBOL,
  temperature FLOAT,
  flag BYTE,
  name STRING,
  date DATE,
  ts TIMESTAMPE
) timestamp(ts) partition by MONTH

you can then send this ILP data

sensors,location=ny temperature=22,flag=6i,name="out",date=1465839830100400 1465839830100400200000

Here date is epoch millisecond and after the space ts is in nano microseconds.

Last nano second timestamp can be omitted and then server will add timestamp on every message at the moment it appends it to the table.

Upvotes: 1

Related Questions