Problem with CSV annotation

Hi there,

i want to upload a annotated csv to my InfluxDB 2.1.1 OSS.

Here is an example of my csv file:

#constant measurement,2022
#concat,dateTime:2006-01-02-15-4-5,$(Date)-$(Hour)-$(Minute)-$(Second)
#datatype time,dateTime:RFC3339
Date,Hour,Minute,Second,Status
2022-01-01,0,0,0,0
2022-01-01,5,0,0,0
2022-01-01,10,0,0,0
2022-01-01,15,0,0,0
...

The first four columns represent the timestamp and the last column is my field value.

While importing the csv, i get this error message:

Failed to upload the selected CSV: error in csv.from(): failed to read metadata: failed to read annotations: wrong number of fields

My problem is: how do i annotate the data to declar my field value or causes the problem the construction of the timestamp? I can’t figure it out with the docs :frowning:

Any help would be appreciated

Greetings
Robert

@Robert How are you trying to upload this CSV? Through the InfluxDB UI or with the influx CLI?

@scott thank you for your reply. I use the UI.

@Robert, you’re currently using Extended Annotated CSV, which is only supported by the influx CLI. The UI only supports plain Annotated CSV. Hopefully this will change in the future, but we’ll see.

  1. Install the influx CLI

  2. Run something like the following:

    influx write \
      --bucket example-bucket \
      --format csv \
      "#constant measurement,2022
    #concat,dateTime:2006-01-02-15-4-5,$(Date)-$(Hour)-$(Minute)-$(Second)
    #datatype time,dateTime:RFC3339
    Date,Hour,Minute,Second,Status
    2022-01-01,0,0,0,0
    2022-01-01,5,0,0,0
    2022-01-01,10,0,0,0
    2022-01-01,15,0,0,0
    "
    

If you want to test this before actually writing it, use the influx write dryrun command with the same flags and arguments.

@scott that helped me a lot. it took some time but now things work like they should. :slight_smile:

So here is me solution:

  1. as suggested install the cli
  2. setup a initial config for the cli, following the manual
  3. annotate the csv file
    this is my annotation snipped:
#constant measurement,2022
#concat dateTime:2006-01-02-15-4-5,${Date}-${Hour}-${Minute}-${Second}
#datatype ignore,ignore,ignore,ignore,field // concat sets already an timestamp so the colums must be ignored
Date,Hour,Minute,Second,Status
2022-01-01,0,0,0,0
2022-01-01,5,0,0,0
2022-01-01,10,0,0,0
2022-01-01,15,0,0,0
  1. fire it up
    here my commands:
    influx write -b yourbucket -f /path/to/your/file.csv --format csv
    The hint with dryrun command was very handy.

I often have timestamps that don’t refer to the RFC3339-Format. So the concat command helps a lot to bring things into shape :wink: .

@scott Support for uploading Extended Annotated CSV in the UI would be a awesome feature. As workaround I set up an SFTP-Server to upload the files to the InfluxDB-Machine. So it would be much more comfortable :smiley:

hope this could help someone.

thanks!