Modify value on existing data

Hello all,

I have data on a table, i would to modify fs=scratchrd by fs=srd :

> select * from RobinhoodScan where fs='scratchrd'
name: RobinhoodScan
time                duration end_date             entries   fs        start_date           type
----                -------- --------             -------   --        ----------           ----
1584979947000000000 145      2020-03-23T16:12:27Z 1310685   scratchrd 2020-03-23T16:10:02Z scan
1585584790000000000 188      2020-03-30T16:13:10Z 1509206   scratchrd 2020-03-30T16:10:01Z scan
1586189581000000000 179      2020-04-06T16:13:01Z 1531971   scratchrd 2020-04-06T16:10:02Z scan
1586794396000000000 177      2020-04-13T16:13:16Z 1572394   scratchrd 2020-04-13T16:10:19Z scan
1588359835000000000 213      2020-05-01T19:03:55Z 1961957   scratchrd 2020-05-01T19:00:21Z scan
1591038869000000000 849      2020-06-01T19:14:29Z 6019245   scratchrd 2020-06-01T19:00:20Z scan
1593630817000000000 795      2020-07-01T19:13:37Z 6253540   scratchrd 2020-07-01T19:00:22Z scan
1596309185000000000 763      2020-08-01T19:13:05Z 5892312   scratchrd 2020-08-01T19:00:21Z scan

I tried this but i had error :

INSERT RobinhoodScan,fs=“test” 1631723617000000000’
ERR: {“error”:“unable to parse ‘RobinhoodScan,fs=“test” 1631723617000000000’: invalid field format”}

You can only update field values, to do so you must write a point with the same key (measurement, tags keys and value, time), once written it will override the previous data.

Your insert does not contain any field, you specified:
RobinhoodScan,fs=“test” 1631723617000000000
in this case the time is being interpreted as the field… as the field is mandatory (without a field a point is invalid as it contains nothing)

the proper format is:
Measurement,tagA=ValueA,TagB=ValueB FieldX=ValueX,FieldY=ValueY time
have a look at:
https://docs.influxdata.com/influxdb/v1.8/write_protocols/line_protocol_tutorial

also note that you don’t need to use double quotes around tag values, doing so will include the quotes in the actual value.

Here is how to solve this kind of issue:
if the data you want to override is a field:

  • just write a valid insert statement to update the value

if the data you want to override is a tag:

  • download/save the data you want to change
  • prepare the insert statement to write them back with the correct values
  • DELETE the existing points
  • INSERT the “new” points with correct values