keyValues() function

The keyValues() function returns a table with the input table’s group key plus two columns, _key and _value, that correspond to unique column + value pairs from the input table.

*Function type: Transformation*

  1. keyValues(keyColumns: ["usage_idle", "usage_user"])

Parameters

keyColumns

A list of columns from which values are extracted. All columns indicated must be of the same type. Each input table must have all of the columns listed by the keyColumns parameter.

*Data type: Array of strings*

Examples

Get key values from explicitly defined columns
  1. from(bucket: "example-bucket")
  2. |> range(start: -30m)
  3. |> filter(fn: (r) => r._measurement == "cpu")
  4. |> keyValues(keyColumns: ["usage_idle", "usage_user"])

Related articles