docs-v2/content/v2.0/reference/flux/functions/built-in/transformations/columns.md

1.8 KiB

title description aliases menu weight
columns() function The `columns()` function lists the column labels of input tables. For each input table, it outputs a table with the same group key columns, plus a new column containing the labels of the input table's columns.
/v2.0/reference/flux/functions/transformations/columns
v2_0_ref
name parent
columns built-in-transformations
401

The columns() function lists the column labels of input tables. For each input table, it outputs a table with the same group key columns, plus a new column containing the labels of the input table's columns. Each row in an output table contains the group key value and the label of one column of the input table. Each output table has the same number of rows as the number of columns of the input table.

Function type: Transformation

columns(column: "_value")

Parameters

column

The name of the output column in which to store the column labels. Defaults to "_value".

Data type: String

Examples

from(bucket: "example-bucket")
  |> range(start: -30m)
  |> columns(column: "labels")
Get every possible column label in a single table
from(bucket: "example-bucket")
  |> range(start: -30m)
  |> columns()
  |> keep(columns: ["_value"])
  |> group()
  |> distinct()

SHOW MEASUREMENTS
SHOW FIELD KEYS
SHOW TAG KEYS
SHOW SERIES