influxdata / influxdata/influx-cli

`influx write` with seperator does not work as without

Open
#517 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
75
Forks
22
PR merge metrics
No merged PRs in 30d

Description

The Example given in influxdb for csv import via CLI is as following, but executing the same commands with a different seperator produces errors.
![image](https://github.com/influxdata/influx-cli/assets/13590797/2756baaa-c7dc-415f-85ad-9ac53bfd1658)
> By the way: There is a typo in dataTime, it should be dateTime

Reproduction:
```bash
> influx version
Influx CLI 2.6.1 (git: 61c5b4d) build_date: 2022-12-29T15:41:09Z
> cat < test.csv
date,sighted,loc
2020-01-01,12,Boise
2020-06-01,78,Boise
2020-01-01,54,Seattle
2020-06-01,112,Seattle
2020-01-01,9,Detroit
2020-06-01,135,Detroit
EOF
> influx write dryrun -b test -f test.csv --header "#constant measurement,birds" --header "#datatype dateTime:2006-01-02,long,tag"

birds,loc=Boise sighted=12i 1577836800000000000
birds,loc=Boise sighted=78i 1590969600000000000
birds,loc=Seattle sighted=54i 1577836800000000000
birds,loc=Seattle sighted=112i 1590969600000000000
birds,loc=Detroit sighted=9i 1577836800000000000
birds,loc=Detroit sighted=135i 1590969600000000000
> sed -i "s/,/;/g" test.csv
> influx write dryrun -b test -f test.csv --header "sep=;" --header "#constant measurement,birds" --header "#datatype dateTime:2006-01-02,long,tag"

2023/06/15 13:24:48 line 5: no measurement column found
2023/06/15 13:24:48 line 6: no measurement column found
2023/06/15 13:24:48 Unable to batcher to error-file: invalid argument
2023/06/15 13:24:48 line 7: no measurement column found
2023/06/15 13:24:48 Unable to batcher to error-file: invalid argument
2023/06/15 13:24:48 line 8: no measurement column found
2023/06/15 13:24:48 Unable to batcher to error-file: invalid argument
2023/06/15 13:24:48 line 9: no measurement column found
2023/06/15 13:24:48 Unable to batcher to error-file: invalid argument
2023/06/15 13:24:48 line 10: no measurement column found
2023/06/15 13:24:48 Unable to batcher to error-file: invalid argument
```

Another thing that came to my mind while trying to import big files is that `influx write dryrun` would greatly benefit from a `--head` or `--max-lines ` option. This way one could try the annotated header without the console exploding. (but thats probably a feature request).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the two `influx write dryrun` commands and trace the CLI's CSV header and separator handling. Done means a semicolon-separated file produces the same line protocol output as the comma-separated example without measurement or error-file failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.