https://questdb.io logo
Title
j

João Calapez

03/06/2023, 12:54 PM
Hi! I'm testing ILP in ruby, I have a pretty straightforward table that is being created with:
"CREATE TABLE IF NOT EXISTS 'sellout_data'(
      date timestamp,
      store_id int,
      product_id int,
      (...other fields...)
      ) timestamp(date) PARTITION BY MONTH;"
"sellout_data,date=#{Date.parse('2021-01-01').<http://to_time.to|to_time.to>_i} store_id=4020i,product_id=309i,sales_in_units=15i,sales_in_volume=7.5\n"
In this line the date is being inputted as 1970-01-01, so I'm guessing that the conversion I'm making isn't working and is falling back to the default value, what am I doing wrong?
i

Imre

03/06/2023, 1:06 PM
since you have
date
set as designated timestamp your line should look like this:
sellout_data store_id=4020i,product_id=309i,sales_in_units=15i,sales_in_volume=7.5 #{Date.parse('2021-01-01').to_time.to_i}\n
the syntax is :
table_name,symbol1=svalue1,symbol2=svalue2 field1=fvalue1,field2=fvalue2 timestamp
where the designated timestamp is in micros
more detailed description of the protocol can be found here: https://questdb.io/docs/reference/api/ilp/overview/
j

javier ramirez

03/06/2023, 5:19 PM
Hi João. Big fan of Ruby here. If it helps, I have a snippet showing how you can convert the current timestamp to nanoseconds, so it is suitable for ingestion via ILP. https://questdb.io/docs/develop/insert-data/#examples