moved fromCSV into csv package, updated string package list title, resolves #146
parent
22e9909ae6
commit
f550223c6d
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
title: Flux CSV package
|
||||||
|
list_title: CSV package
|
||||||
|
description: >
|
||||||
|
The Flux CSV package provides functions for working with data in annotated CSV format.
|
||||||
|
Import the `csv` package.
|
||||||
|
menu:
|
||||||
|
v2_0_ref:
|
||||||
|
name: CSV
|
||||||
|
parent: Flux packages and functions
|
||||||
|
weight: 202
|
||||||
|
v2.0/tags: [functions, csv, package]
|
||||||
|
---
|
||||||
|
|
||||||
|
CSV Flux functions provide tools for working with data in [annotated CSV format](https://github.com/influxdata/flux/blob/master/docs/SPEC.md#csv).
|
||||||
|
Import the `csv` package:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import "csv"
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< children type="functions" show="pages" >}}
|
|
@ -1,29 +1,31 @@
|
||||||
---
|
---
|
||||||
title: fromCSV() function
|
title: csv.from() function
|
||||||
description: The `fromCSV()` function retrieves data from a CSV data source.
|
description: The `csv.from()` function retrieves data from a CSV data source.
|
||||||
aliases:
|
aliases:
|
||||||
- /v2.0/reference/flux/functions/inputs/fromcsv
|
- /v2.0/reference/flux/functions/inputs/fromcsv
|
||||||
|
- /v2.0/reference/flux/functions/built-in/inputs/fromcsv
|
||||||
menu:
|
menu:
|
||||||
v2_0_ref:
|
v2_0_ref:
|
||||||
name: fromCSV
|
name: csv.from
|
||||||
parent: built-in-inputs
|
parent: CSV
|
||||||
weight: 401
|
weight: 202
|
||||||
---
|
---
|
||||||
|
|
||||||
The `fromCSV()` function retrieves data from a comma-separated value (CSV) data source.
|
The `csv.from()` function retrieves data from a comma-separated value (CSV) data source.
|
||||||
It returns a stream of tables.
|
It returns a stream of tables.
|
||||||
Each unique series is contained within its own table.
|
Each unique series is contained within its own table.
|
||||||
Each record in the table represents a single point in the series.
|
Each record in the table represents a single point in the series.
|
||||||
|
|
||||||
_**Function type:** Input_
|
_**Function type:** Input_
|
||||||
_**Output data type:** Object_
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
from(file: "/path/to/data-file.csv")
|
import "csv"
|
||||||
|
|
||||||
|
csv.from(file: "/path/to/data-file.csv")
|
||||||
|
|
||||||
// OR
|
// OR
|
||||||
|
|
||||||
from(csv: csvData)
|
csv.from(csv: csvData)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
@ -32,6 +34,7 @@ from(csv: csvData)
|
||||||
The file path of the CSV file to query.
|
The file path of the CSV file to query.
|
||||||
The path can be absolute or relative.
|
The path can be absolute or relative.
|
||||||
If relative, it is relative to the working directory of the `influxd` process.
|
If relative, it is relative to the working directory of the `influxd` process.
|
||||||
|
_The CSV file must exist in the same file system running the `influxd` process._
|
||||||
|
|
||||||
_**Data type:** String_
|
_**Data type:** String_
|
||||||
|
|
||||||
|
@ -50,11 +53,15 @@ _**Data type:** String_
|
||||||
|
|
||||||
### Query CSV data from a file
|
### Query CSV data from a file
|
||||||
```js
|
```js
|
||||||
from(file: "/path/to/data-file.csv")
|
import "csv"
|
||||||
|
|
||||||
|
csv.from(file: "/path/to/data-file.csv")
|
||||||
```
|
```
|
||||||
|
|
||||||
### Query raw CSV-formatted text
|
### Query raw CSV-formatted text
|
||||||
```js
|
```js
|
||||||
|
import "csv"
|
||||||
|
|
||||||
csvData = "
|
csvData = "
|
||||||
result,table,_start,_stop,_time,region,host,_value
|
result,table,_start,_stop,_time,region,host,_value
|
||||||
mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:00Z,east,A,15.43
|
mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:00Z,east,A,15.43
|
||||||
|
@ -62,5 +69,5 @@ mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:20Z,east,B,59.
|
||||||
mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:40Z,east,C,52.62
|
mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:40Z,east,C,52.62
|
||||||
"
|
"
|
||||||
|
|
||||||
from(csv: csvData)
|
csv.from(csv: csvData)
|
||||||
```
|
```
|
|
@ -6,7 +6,7 @@ description: >
|
||||||
Import the `strings` package.
|
Import the `strings` package.
|
||||||
menu:
|
menu:
|
||||||
v2_0_ref:
|
v2_0_ref:
|
||||||
name: Strings
|
name: String
|
||||||
parent: Flux packages and functions
|
parent: Flux packages and functions
|
||||||
weight: 204
|
weight: 204
|
||||||
v2.0/tags: [strings, functions, package]
|
v2.0/tags: [strings, functions, package]
|
||||||
|
|
Loading…
Reference in New Issue