array.from() function

The array.from() function is experimental and subject to change at any time. By using this function, you accept the risks of experimental functions.

Flux v0.103.0 promoted the array package and the array.from function out of the experimental package. View array.from.

The experimental array.from() function constructs a table from an array of records. Each record in the array is converted into an output row or record. All records must have the same keys and data types.

Function type: Input

import "experimental/array"

array.from(rows: [
  {_time: 2020-01-01T00:00:00Z, _field: "exampleField", _value: 3, foo: "bar"},
  {_time: 2020-01-01T00:01:00Z, _field: "exampleField", _value: 4, foo: "bar"},
  {_time: 2020-01-01T00:02:00Z, _field: "exampleField", _value: 1, foo: "bar"}



Array of records to construct a table with.

Data type: Array of records


Build an arbitrary table
import "experimental/array"

rows = [
  {foo: "bar", baz: 21.2}
  {foo: "bar", baz: 23.8}

array.from(rows: rows)
Union custom rows with query results
import "influxdata/influxdb/v1"
import "experimental/array"

tags = v1.tagValues(
  bucket: "example-bucket",
  tag: "host"

wildcard_tag = array.from(rows: [{_value: "*"}])

union(tables: [tags, wildcard_tag])

Select your region

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.