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. 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.

columns(column: "_value")



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


Input data. Default is piped-forward data (<-).


The following example uses data provided by the sampledata package to show how columns() transforms data.

List all columns per table

import "sampledata"

    |> columns(column: "labels")

View input and output

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.