Search code examples
influxdbinfluxdb-2

Which csv format is appropriate for influxdb2?


I'm going to put the csv file into the bucket using influxdb v2.1.

Attempting to insert a simple example file results in the following error:

error in csv.from(): failed to read metadata: failed to read annotations: expected annotation datatype

The csv file that I was going to write is as follows.

#datatype measurement,tag,double,dateTime:RFC3339
m,host,used_percent,time
mem,host1,64.23,2020-01-01T00:00:00Z
mem,host2,72.01,2020-01-01T00:00:00Z
mem,host1,62.61,2020-01-01T00:00:10Z
mem,host2,72.98,2020-01-01T00:00:10Z
mem,host1,63.40,2020-01-01T00:00:20Z
mem,host2,73.77,2020-01-01T00:00:20Z

This is the example data in the official document of influxdata.

If you look at the first line of the example, you can see that datatype is annotated, but why does the error occur?

How should I modify it?


Solution

  • This looks like invalid annotated CVS.

    In the csv.from function documentation, you can find examples (as string literals) of both annotated and raw CVS that the cvs.from supports.