Michael
Michael

Reputation: 620

influxdb update time on rows

I've been pushing records into influxDB from node-red, but Javascript defauls time to milliseconds while influxdb defaults time to nanoseconds.

msg.payload.time = new Date().getTime();

I've fixed the problem by specifying influx's precision before the insert

msg.precision = 'ms';
msg.payload.time = new Date().getTime();

But I already have a lot of existing records in my database where I need to multiply time by 1,000,000 so that the dates aren't stuck in the 1970's.

I tried to fix my existing data by running

UPDATE payloads SET time = (time * 1000000)

but I get the error

ERR: error parsing query: found update, expected SELECT, DELETE, SHOW, 
CREATE, DROP, GRANT, REVOKE, ALTER, SET, KILL at line 1, char 1

So... whre is the UPDATE command? How do you update the time in influxdb without an UPDATE statement?

Upvotes: 2

Views: 2636

Answers (1)

Michael
Michael

Reputation: 620

A colleague has informed me that InfluxDB does not support UPDATE statements.

Influx rationalises this omission in point 3 of their "insights and tradeoffs" here.

If you need to update data, use SELECT INTO and rebuild the data from the ground up as described here.

Upvotes: 1

Related Questions