2.8 KiB
title | description | menu | weight | flux/v0.x/tags | aliases | related | introduced | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
schema.measurementFieldKeys() function | The `schema.measurementFieldKeys()` function returns a list of fields in a measurement. |
|
301 |
|
|
|
0.88.0 |
The schema.measurementFieldKeys()
function returns a list of fields in a measurement.
The return value is always a single table with a single column, _value
.
import "influxdata/influxdb/schema"
schema.measurementFieldKeys(
bucket: "example-bucket",
measurement: "example-measurement",
start: -30d,
)
{{% note %}}
Deleted fields
Fields explicitly deleted from InfluxDB Cloud do not appear in results.
Expired fields
- InfluxDB Cloud: field keys associated with points outside of the bucket's retention policy may appear in results up to an hour after expiring.
- InfluxDB OSS: field keys associated with points outside of the bucket's retention policy may appear in results. For more information, see [Data retention in InfluxDB OSS](/{{< latest "influxdb" >}}/reference/internals/data-retention/). {{% /note %}}
Parameters
bucket
Bucket to retrieve field keys from.
measurement
Measurement to list field keys from.
start
Earliest time to include in results.
Defaults to -30d
.
Relative start times are defined using negative durations. Negative durations are relative to now. Absolute start times are defined using time values.
stop
Latest time to include in results.
Default is now()
.
The stop
time is exclusive, meaning values with a time equal to stop time are
excluded from results.
Relative start times are defined using negative durations.
Negative durations are relative to now()
.
Absolute start times are defined using time values.
Examples
Return all field keys in a measurement
import "influxdata/influxdb/schema"
schema.measurementFieldKeys(bucket: "example-bucket", measurement: "example-measurement")
Return all field keys in a measurement from a non-default time range
import "influxdata/influxdb/schema"
schema.measurementFieldKeys(bucket: "example-bucket", measurement: "example-measurement", start: -90d, stop: -60d)