databasetime-seriesquestdb

Importing CSV with timestamps in milliseconds


I am trying to import a CSV file to an existing table. The timestamps defined in the CSV file are in milliseconds. If I try to importing using the REST API or web interface I get an error on all timestamp columns.

This is how my files look like:

id,exchange,symbol,date,price,amount,sell
829895171,bw,suiusdt_perp,1741219201694,2.6313,0.9,true

And this is the schema of my table

CREATE TABLE crypto_trades_binance_btcusd_perp (
    id LONG,
    exchange SYMBOL,
    symbol SYMBOL,
    date TIMESTAMP,
    price DOUBLE,
    amount DOUBLE,
    sell BOOLEAN
) TIMESTAMP(date) PARTITION BY MONTH

I know that when importing using SQL statements, I can cast values, e.g.

INSERT INTO crypto_trades_binance_btcusd_perp
VALUES ('829895171', 'bw', 'suiusdt_perp', cast(1741219201694 * 1000 as TIMESTAMP), 2.6313,0.9,true)

Is it possible to cast the timestamp values when importing from a CSV with the REST API or web interface as well?


Solution

  • QuestDB does not support, as of today, any flags for this type of casting as part of CSV import.

    Here are some options we have: