From 74ef60b5233296adcb8fd6a9d76bd8eb6fefca40 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 22 Jun 2020 16:27:59 -0600 Subject: [PATCH 1/2] ignore columns in csv data, resolves #1122 --- content/v2.0/write-data/csv.md | 62 +++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/content/v2.0/write-data/csv.md b/content/v2.0/write-data/csv.md index 9d0f2e51a..1bb061980 100644 --- a/content/v2.0/write-data/csv.md +++ b/content/v2.0/write-data/csv.md @@ -112,12 +112,12 @@ date,sighted,loc {{% flex-content %}} ##### Resulting line protocol ``` -birds,loc=Boise sighted=12 1577836800000000000 -birds,loc=Boise sighted=78 1590969600000000000 -birds,loc=Seattle sighted=54 1577836800000000000 -birds,loc=Seattle sighted=112 1590969600000000000 -birds,loc=Detroit sighted=9 1577836800000000000 -birds,loc=Detroit sighted=135 1590969600000000000 +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 ``` {{% /flex-content %}} {{< /flex >}} @@ -157,12 +157,12 @@ date,sighted,loc ##### Resulting line protocol ``` -birds,loc=Boise sighted=12 1577836800000000000 -birds,loc=Boise sighted=78 1590969600000000000 -birds,loc=Seattle sighted=54 1577836800000000000 -birds,loc=Seattle sighted=112 1590969600000000000 -birds,loc=Detroit sighted=9 1577836800000000000 -birds,loc=Detroit sighted=135 1590969600000000000 +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 ``` ## Skip annotation headers @@ -228,6 +228,7 @@ Skipped rows are ignored and are not written to InfluxDB. - [Define constants](#define-constants) - [Annotation shorthand](#annotation-shorthand) +- [Ignore columns](#ignore-columns) - [Use alternate numeric formats](#use-alternate-numeric-formats) - [Use alternate boolean format](#use-alternate-boolean-format) - [Use different timestamp formats](#use-different-timestamp-formats) @@ -326,10 +327,39 @@ example,18,2020-01-04T00:00:00Z {{% flex-content %}} ##### Resulting line protocol ``` -example count=1 1577836800000000000 -example count=4 1577923200000000000 -example count=0 1578009600000000000 -example count=18 1578096000000000000 +example count=1i 1577836800000000000 +example count=4i 1577923200000000000 +example count=0i 1578009600000000000 +example count=18i 1578096000000000000 +``` +{{% /flex-content %}} +{{< /flex >}} + +--- + +### Ignore columns +Use the Extended annotated CSV [`#datatype ignored` annotation](/v2.0/reference/syntax/annotated-csv/extended/#ignored) +to ignore columns when writing CSV data to InfluxDB. + +{{< flex >}} +{{% flex-content %}} +##### CSV data with ignored column +``` +#datatype measurement,long,time,ignored +m,count,time,foo +example,1,2020-01-01T00:00:00Z,bar +example,4,2020-01-02T00:00:00Z,bar +example,,2020-01-03T00:00:00Z,baz +example,18,2020-01-04T00:00:00Z,baz +``` +{{% /flex-content %}} +{{% flex-content %}} +##### Resulting line protocol +``` +m count=1i 1577836800000000000 +m count=4i 1577923200000000000 +m count=9i 1578009600000000000 +m count=18i 1578096000000000000 ``` {{% /flex-content %}} {{< /flex >}} From b92b1b3b96c2e64e3b196ea8cb46fe6eb5e7a6e3 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 22 Jun 2020 16:43:59 -0600 Subject: [PATCH 2/2] Update content/v2.0/write-data/csv.md Co-authored-by: Russ Savage --- content/v2.0/write-data/csv.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v2.0/write-data/csv.md b/content/v2.0/write-data/csv.md index 1bb061980..6116a58e4 100644 --- a/content/v2.0/write-data/csv.md +++ b/content/v2.0/write-data/csv.md @@ -349,7 +349,7 @@ to ignore columns when writing CSV data to InfluxDB. m,count,time,foo example,1,2020-01-01T00:00:00Z,bar example,4,2020-01-02T00:00:00Z,bar -example,,2020-01-03T00:00:00Z,baz +example,9,2020-01-03T00:00:00Z,baz example,18,2020-01-04T00:00:00Z,baz ``` {{% /flex-content %}}