Documentation

Flux stream and table functions

Use stream and table functions to extract a table from a stream of tables and access its columns and records.

Example stream and table functions

data = from(bucket:"example-bucket")
  |> range(start: -5m)
  |> filter(fn:(r) => r._measurement == "cpu")

// Extract the "_value" column from the table
data
  |> findColumn(fn: (key) => key._field == "usage_idle", column: "_value")

// Extract the first record from the table
data
  |> findRecord(fn: (key) => key._field == "usage_idle", idx: 0)

Alternate usage
data = from(bucket:"example-bucket")
  |> range(start: -5m)
  |> filter(fn:(r) => r._measurement == "cpu")

// Extract the first available table for which "_field" is equal to "usage_idle"
t = data |> tableFind(fn: (key) => key._field == "usage_idle")

// Extract the "_value" column from the table
values = t |> getColumn(column: "_value")

// Extract the first record from the table
r0 = t |> getRecord(idx: 0)

Set your InfluxDB URL

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.