From a9bfeff3d483ac2a2797e736420e0d03e2d6a074 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Tue, 20 Oct 2020 09:17:00 -0600 Subject: [PATCH] Readd deprecated v1 functions and update schema package (#1681) * readded deprecated v1 pkg functions * updated schema exploration guide and variable queries with schema package * updated schema pkg to address PR feedback --- .../v2.0/query-data/flux/explore-schema.md | 66 ++++++------- .../{schema => influxdb-schema}/_index.md | 8 +- .../{schema => influxdb-schema}/fieldkeys.md | 5 +- .../fieldsascols.md | 9 +- .../measurementfieldkeys.md | 9 +- .../measurements.md | 3 +- .../measurementtagkeys.md | 5 +- .../measurementtagvalues.md | 7 +- .../{schema => influxdb-schema}/tagkeys.md | 9 +- .../{schema => influxdb-schema}/tagvalues.md | 13 +-- .../flux/stdlib/influxdb-v1/_index.md | 35 ++++--- .../flux/stdlib/influxdb-v1/fieldkeys.md | 76 +++++++++++++++ .../flux/stdlib/influxdb-v1/fieldsascols.md | 61 ++++++++++++ .../influxdb-v1/measurementfieldkeys.md | 78 +++++++++++++++ .../flux/stdlib/influxdb-v1/measurements.md | 49 ++++++++++ .../stdlib/influxdb-v1/measurementtagkeys.md | 60 ++++++++++++ .../influxdb-v1/measurementtagvalues.md | 68 +++++++++++++ .../flux/stdlib/influxdb-v1/tagkeys.md | 87 +++++++++++++++++ .../flux/stdlib/influxdb-v1/tagvalues.md | 95 +++++++++++++++++++ .../v2.0/reference/release-notes/flux.md | 2 +- .../variables/common-variables.md | 54 ++++++----- 21 files changed, 697 insertions(+), 102 deletions(-) rename content/influxdb/v2.0/reference/flux/stdlib/{schema => influxdb-schema}/_index.md (59%) rename content/influxdb/v2.0/reference/flux/stdlib/{schema => influxdb-schema}/fieldkeys.md (85%) rename content/influxdb/v2.0/reference/flux/stdlib/{schema => influxdb-schema}/fieldsascols.md (75%) rename content/influxdb/v2.0/reference/flux/stdlib/{schema => influxdb-schema}/measurementfieldkeys.md (86%) rename content/influxdb/v2.0/reference/flux/stdlib/{schema => influxdb-schema}/measurements.md (94%) rename content/influxdb/v2.0/reference/flux/stdlib/{schema => influxdb-schema}/measurementtagkeys.md (91%) rename content/influxdb/v2.0/reference/flux/stdlib/{schema => influxdb-schema}/measurementtagvalues.md (88%) rename content/influxdb/v2.0/reference/flux/stdlib/{schema => influxdb-schema}/tagkeys.md (89%) rename content/influxdb/v2.0/reference/flux/stdlib/{schema => influxdb-schema}/tagvalues.md (84%) create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/fieldsascols.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementfieldkeys.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurements.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagkeys.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagvalues.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagkeys.md create mode 100644 content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues.md diff --git a/content/influxdb/v2.0/query-data/flux/explore-schema.md b/content/influxdb/v2.0/query-data/flux/explore-schema.md index 054b6c813..e9abd1dca 100644 --- a/content/influxdb/v2.0/query-data/flux/explore-schema.md +++ b/content/influxdb/v2.0/query-data/flux/explore-schema.md @@ -12,31 +12,31 @@ menu: weight: 206 related: - /influxdb/v2.0/reference/flux/stdlib/built-in/inputs/buckets/ - - /influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurements - - /influxdb/v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys - - /influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementfieldkeys - - /influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagkeys - - /influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagkeys - - /influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues - - /influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagvalues + - /influxdb/v2.0/reference/flux/stdlib/schema/measurements + - /influxdb/v2.0/reference/flux/stdlib/schema/fieldkeys + - /influxdb/v2.0/reference/flux/stdlib/schema/measurementfieldkeys + - /influxdb/v2.0/reference/flux/stdlib/schema/tagkeys + - /influxdb/v2.0/reference/flux/stdlib/schema/measurementtagkeys + - /influxdb/v2.0/reference/flux/stdlib/schema/tagvalues + - /influxdb/v2.0/reference/flux/stdlib/schema/measurementtagvalues list_code_example: | ```js - import "influxdata/influxdb/v1" + import "influxdata/influxdb/schema" // List buckets buckets() // List measurements - v1.measurements(bucket: "example-bucket") + schema.measurements(bucket: "example-bucket") // List field keys - v1.fieldKeys(bucket: "example-bucket") + schema.fieldKeys(bucket: "example-bucket") // List tag keys - v1.tagKeys(bucket: "example-bucket") + schema.tagKeys(bucket: "example-bucket") // List tag values - v1.tagValues(bucket: "example-bucket", tag: "example-tag") + schema.tagValues(bucket: "example-bucket", tag: "example-tag") ``` --- @@ -58,81 +58,81 @@ buckets() ``` ## List measurements -Use the [`v1.measurements()` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurements) +Use the [`schema.measurements()` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurements) to list **measurements in a bucket**. ```js -import "influxdata/influxdb/v1" +import "influxdata/influxdb/schema" -v1.measurements(bucket: "example-bucket") +schema.measurements(bucket: "example-bucket") ``` ## List field keys -Use the [`v1.fieldKeys` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys) +Use the [`schema.fieldKeys` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldkeys) to list **field keys in a bucket**. ```js -import "influxdata/influxdb/v1" +import "influxdata/influxdb/schema" -v1.fieldKeys(bucket: "example-bucket") +schema.fieldKeys(bucket: "example-bucket") ``` ### List fields in a measurement -Use the [`v1.measurementFieldKeys` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementfieldkeys) +Use the [`schema.measurementFieldKeys` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementfieldkeys) to list **field keys in a measurement**. ```js -import "influxdata/influxdb/v1" +import "influxdata/influxdb/schema" -v1.measurementFieldKeys( +schema.measurementFieldKeys( bucket: "example-bucket", measurement: "example-measurement" ) ``` ## List tag keys -Use the [`v1.tagKeys()` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagkeys) +Use the [`schema.tagKeys()` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagkeys) to list **tag keys in a bucket**. ```js -import "influxdata/influxdb/v1" +import "influxdata/influxdb/schema" -v1.tagKeys(bucket: "example-bucket") +schema.tagKeys(bucket: "example-bucket") ``` ### List tag keys in a measurement -Use the [`v1.measurementTagKeys` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagkeys) +Use the [`schema.measurementTagKeys` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagkeys) to list **tag keys in a measurement**. _This function returns results from the last 30 days._ ```js -import "influxdata/influxdb/v1" +import "influxdata/influxdb/schema" -v1.measurementTagKeys( +schema.measurementTagKeys( bucket: "example-bucket", measurement: "example-measurement" ) ``` ## List tag values -Use the [`v1.tagValues()` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues) +Use the [`schema.tagValues()` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues) to list **tag values for a given tag in a bucket**. ```js -import "influxdata/influxdb/v1" +import "influxdata/influxdb/schema" -v1.tagValues(bucket: "example-bucket", tag: "example-tag") +schema.tagValues(bucket: "example-bucket", tag: "example-tag") ``` ### List tag values in a measurement -Use the [`v1.measurementTagValues` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagvalues) +Use the [`schema.measurementTagValues` function](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagvalues) to list **tag values for a given tag in a measurement**. _This function returns results from the last 30 days._ ```js -import "influxdata/influxdb/v1" +import "influxdata/influxdb/schema" -v1.measurementTagValues( +schema.measurementTagValues( bucket: "example-bucket", tag: "example-tag", measurement: "example-measurement" diff --git a/content/influxdb/v2.0/reference/flux/stdlib/schema/_index.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/_index.md similarity index 59% rename from content/influxdb/v2.0/reference/flux/stdlib/schema/_index.md rename to content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/_index.md index 11bbcdb6e..7020d97a1 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/schema/_index.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/_index.md @@ -2,8 +2,7 @@ title: Flux InfluxDB schema package list_title: InfluxDB schema package description: > - The Flux InfluxDB schema package provides functions for managing data from an InfluxDB v1.x - database or structured using the InfluxDB schema data structure. + The Flux InfluxDB schema package provides functions for exploring your InfluxDB data schema. Import the `influxdata/influxdb/schema` package. aliases: - /influxdb/v2.0/reference/flux/functions/influxdb-v1/ @@ -12,10 +11,11 @@ menu: name: InfluxDB Schema parent: Flux standard library weight: 202 -influxdb/v2.0/tags: [functions, influxdb-v1, package] +influxdb/v2.0/tags: [functions, schema, package] +introduced: 0.88.0 --- -InfluxDB schema Flux functions provide tools for managing data from an InfluxDB database. +The Flux InfluxDB schema package provides functions for exploring your InfluxDB data schema. Import the `influxdata/influxdb/schema` package: diff --git a/content/influxdb/v2.0/reference/flux/stdlib/schema/fieldkeys.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldkeys.md similarity index 85% rename from content/influxdb/v2.0/reference/flux/stdlib/schema/fieldkeys.md rename to content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldkeys.md index 807cc5d10..02e86669f 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/schema/fieldkeys.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldkeys.md @@ -12,9 +12,10 @@ aliases: related: - /influxdb/v2.0/query-data/flux/explore-schema/ - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-field-keys, SHOW FIELD KEYS in InfluxQL +introduced: 0.88.0 --- -The `schema.fieldKeys()` function returns field keys in a bucket. +The `schema.fieldKeys()` function returns [field keys](/influxdb/v2.0/reference/glossary/#field-key) in a bucket. The return value is always a single table with a single column, `_value`. ```js @@ -46,7 +47,7 @@ _Defaults to `-30d`._ Relative start times are defined using negative durations. Negative durations are relative to now. -Absolute start times are defined using timestamps. +Absolute start times are defined using [time values](/influxdb/v2.0/reference/flux/language/types/#time-types). _**Data type:** Duration_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/schema/fieldsascols.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldsascols.md similarity index 75% rename from content/influxdb/v2.0/reference/flux/stdlib/schema/fieldsascols.md rename to content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldsascols.md index 2d00b6ba7..866807e3f 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/schema/fieldsascols.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldsascols.md @@ -1,6 +1,6 @@ --- title: schema.fieldsAsCols() function -description: The schema.fieldsAsCols() function is pivots a table and automatically aligns fields within each input table that have the same timestamp. +description: The schema.fieldsAsCols() function pivots a table to automatically align fields within each input table that have the same timestamp. aliases: - /influxdb/v2.0/reference/flux/functions/inputs/fromrows - /influxdb/v2.0/reference/flux/functions/transformations/influxfieldsascols @@ -11,10 +11,13 @@ menu: name: schema.fieldsAsCols parent: InfluxDB Schema weight: 301 +introduced: 0.88.0 --- -The `schema.fieldsAsCols()` function is a special application of the `pivot()` function that -automatically aligns fields within each input table that have the same timestamp. +The `schema.fieldsAsCols()` function is a special application of the +[`pivot()`](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/pivot/) +function that pivots on `_field` and `_time` columns to aligns fields within each +input table that have the same timestamp. _**Function type:** Transformation_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/schema/measurementfieldkeys.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementfieldkeys.md similarity index 86% rename from content/influxdb/v2.0/reference/flux/stdlib/schema/measurementfieldkeys.md rename to content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementfieldkeys.md index eff25a9a7..47aaa2b7e 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/schema/measurementfieldkeys.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementfieldkeys.md @@ -12,6 +12,7 @@ aliases: related: - /influxdb/v2.0/query-data/flux/explore-schema/ - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-field-keys, SHOW FIELD KEYS in InfluxQL +introduced: 0.88.0 --- The `schema.measurementFieldKeys()` function returns a list of fields in a measurement. @@ -30,22 +31,22 @@ schema.measurementFieldKeys( ## Parameters ### bucket -The bucket to list field keys from. +Bucket to retrieve field keys from. _**Data type:** String_ ### measurement -The measurement to list field keys from. +Measurement to list field keys from. _**Data type:** String_ ### start -The oldest time to include in results. +Oldest 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 timestamps. +Absolute start times are defined using [time values](/influxdb/v2.0/reference/flux/language/types/#time-types). _**Data type:** Duration_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/schema/measurements.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurements.md similarity index 94% rename from content/influxdb/v2.0/reference/flux/stdlib/schema/measurements.md rename to content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurements.md index 4b60a1e09..42f6bb4a8 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/schema/measurements.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurements.md @@ -12,6 +12,7 @@ influxdb/v2.0/tags: [measurements] related: - /influxdb/v2.0/query-data/flux/explore-schema/ - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-measurements, SHOW MEASUREMENTS in InfluxQL +introduced: 0.88.0 --- The `schema.measurements()` function returns a list of measurements in a specific bucket. @@ -26,7 +27,7 @@ schema.measurements(bucket: "example-bucket") ## Parameters ### bucket -The bucket from which to list measurements. +Bucket to retrieve measurements from. _**Data type:** String_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/schema/measurementtagkeys.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagkeys.md similarity index 91% rename from content/influxdb/v2.0/reference/flux/stdlib/schema/measurementtagkeys.md rename to content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagkeys.md index 31302b035..330f3becc 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/schema/measurementtagkeys.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagkeys.md @@ -12,6 +12,7 @@ influxdb/v2.0/tags: [tags] related: - /influxdb/v2.0/query-data/flux/explore-schema/ - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-tag-keys, SHOW TAG KEYS in InfluxQL +introduced: 0.88.0 --- The `schema.measurementTagKeys()` function returns a list of tag keys for a specific measurement. @@ -29,12 +30,12 @@ schema.measurementTagKeys( ## Parameters ### bucket -The bucket from which to return tag keys for a specific measurement. +Bucket to return tag keys from for a specific measurement. _**Data type:** String_ ### measurement -The measurement from which to return tag keys. +Measurement to return tag keys from. _**Data type:** String_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/schema/measurementtagvalues.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagvalues.md similarity index 88% rename from content/influxdb/v2.0/reference/flux/stdlib/schema/measurementtagvalues.md rename to content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagvalues.md index 043b61faf..799840ed2 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/schema/measurementtagvalues.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagvalues.md @@ -12,6 +12,7 @@ influxdb/v2.0/tags: [tags] related: - /influxdb/v2.0/query-data/flux/explore-schema/ - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-tag-values, SHOW TAG VALUES in InfluxQL +introduced: 0.88.0 --- The `schema.measurementTagValues()` function returns a list of tag values for a specific measurement. @@ -32,17 +33,17 @@ schema.measurementTagValues( ## Parameters ### bucket -The bucket from which to return tag values for a specific measurement. +Bucket to return tag values from for a specific measurement. _**Data type:** String_ ### measurement -The measurement from which to return tag values. +Measurement to return tag values from. _**Data type:** String_ ### tag -The tag from which to return all unique values. +Tag to return all unique values from. _**Data type:** String_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/schema/tagkeys.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagkeys.md similarity index 89% rename from content/influxdb/v2.0/reference/flux/stdlib/schema/tagkeys.md rename to content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagkeys.md index da00aea15..dcbc57a78 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/schema/tagkeys.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagkeys.md @@ -12,6 +12,7 @@ influxdb/v2.0/tags: [tags] related: - /influxdb/v2.0/query-data/flux/explore-schema/ - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-tag-keys, SHOW TAG KEYS in InfluxQL +introduced: 0.88.0 --- The `schema.tagKeys()` function returns a list of tag keys for all series that match the [`predicate`](#predicate). @@ -30,23 +31,23 @@ schema.tagKeys( ## Parameters ### bucket -The bucket from which to list tag keys. +Bucket to return tag keys from. _**Data type:** String_ ### predicate -The predicate function that filters tag keys. +Predicate function that filters tag keys. _Defaults to `(r) => true`._ _**Data type:** Function_ ### start -The oldest time to include in results. +Oldest 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 timestamps. +Absolute start times are defined using [time values](/influxdb/v2.0/reference/flux/language/types/#time-types). _**Data type:** Duration_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/schema/tagvalues.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues.md similarity index 84% rename from content/influxdb/v2.0/reference/flux/stdlib/schema/tagvalues.md rename to content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues.md index 2a4212aab..b82b411bd 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/schema/tagvalues.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues.md @@ -12,9 +12,10 @@ influxdb/v2.0/tags: [tags] related: - /influxdb/v2.0/query-data/flux/explore-schema/ - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-tag-values, SHOW TAG VALUES in InfluxQL +introduced: 0.88.0 --- -The `schema.tagValues()` function returns a list unique values for a given tag. +The `schema.tagValues()` function returns a list of unique values for a given tag. The return value is always a single table with a single column, `_value`. ```js @@ -31,28 +32,28 @@ schema.tagValues( ## Parameters ### bucket -The bucket from which to list tag values. +Bucket to return unique tag values from. _**Data type:** String_ ### tag -The tag for which to return unique values. +Tag to return unique values from. _**Data type:** String_ ### predicate -The predicate function that filters tag values. +Predicate function that filters tag values. _Defaults to `(r) => true`._ _**Data type:** Function_ ### start -The oldest time to include in results. +Oldest 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 timestamps. +Absolute start times are defined using [time values](/influxdb/v2.0/reference/flux/language/types/#time-types). _**Data type:** Duration_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/_index.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/_index.md index e476b7714..932bdded8 100644 --- a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/_index.md +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/_index.md @@ -13,23 +13,9 @@ menu: parent: Flux standard library weight: 202 influxdb/v2.0/tags: [functions, influxdb-v1, package] +introduced: 0.16.0 --- -{{% note %}} -The following functions from the `v1` package have moved to [`schema`](/influxdb/v2.0/reference/flux/stdlib/schema): - -- [`schema.fieldKeys`](/influxdb/v2.0/reference/flux/stdlib/schema/fieldkeys/) -- [`schema.fieldsAsCols`](/influxdb/v2.0/reference/flux/stdlib/schema/fieldsascols/) -- [`schema.measurementFieldKeys`](/influxdb/v2.0/reference/flux/stdlib/schema/measurementfieldkeys/) -- [`schema.measurements`](/influxdb/v2.0/reference/flux/stdlib/schema/measurements/) -- [`schema.measurementTagKeys`](/influxdb/v2.0/reference/flux/stdlib/schema/measurementtagkeys/) -- [`schema.measurementTagValues`](/influxdb/v2.0/reference/flux/stdlib/schema/measurementtagvalues/) -- [`schema.tagKeys`](/influxdb/v2.0/reference/flux/stdlib/schema/tagkeys/) -- [`schema.tagValues`](/influxdb/v2.0/reference/flux/stdlib/schema/tagvalues/) - -These functions are still available in the `v1` package for backwards compatibility, but are now deprecated in favor of `schema`. -{{% /note %}} - InfluxDB v1 Flux functions provide tools for managing data from an InfluxDB v1.x database or structured using the InfluxDB v1 data structure. Import the `influxdata/influxdb/v1` package: @@ -39,3 +25,22 @@ import "influxdata/influxdb/v1" ``` {{< children type="functions" show="pages" >}} + +{{% warn %}} +#### Deprecated functions +In **Flux 0.88.0**, the following InfluxDB v1 package functions moved to the +[InfluxDB schema package](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/). +These functions are still available in the `v1` package for backwards compatibility, +but are deprecated in favor of `schema`. + +| Deprecated v1 function | → | Corresponding schema function | +|:------------------- |:-:|:------------------------ | +| **v1.fieldKeys()** | → | [schema.fieldKeys()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldkeys/) | +| **v1.fieldsAsCols()** | → | [schema.fieldsAsCols()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldsascols/) | +| **v1.measurementFieldKeys()** | → | [schema.measurementFieldKeys()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementfieldkeys/) | +| **v1.measurements()** | → | [schema.measurements()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurements/) | +| **v1.measurementTagKeys()** | → | [schema.measurementTagKeys()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagkeys/) | +| **v1.measurementTagValues()** | → | [schema.measurementTagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagvalues/) | +| **v1.tagKeys()** | → | [schema.tagKeys()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagkeys/) | +| **v1.tagValues()** | → | [schema.tagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues/) | +{{% /warn %}} diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys.md new file mode 100644 index 000000000..0a3bbd403 --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys.md @@ -0,0 +1,76 @@ +--- +title: v1.fieldKeys() function +description: The `v1.fieldKeys()` function returns field keys in a bucket. +menu: + influxdb_2_0_ref: + name: v1.fieldKeys + parent: InfluxDB v1 +weight: 301 +influxdb/v2.0/tags: [fields] +aliases: + - /influxdb/v2.0/reference/flux/functions/influxdb-v1/fieldkeys +related: + - /influxdb/v2.0/query-data/flux/explore-schema/ + - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-field-keys, SHOW FIELD KEYS in InfluxQL +introduced: 0.68.0 +deprecated: 0.88.0 +--- + +{{% warn %}} +`v1.fieldKeys()` was deprecated in **Flux v0.88.0** in favor of +[`schema.fieldKeys()`](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldkeys/). +{{% /warn %}} + +The `v1.fieldKeys()` function returns [field keys](/influxdb/v2.0/reference/glossary/#field-key) in a bucket. +The return value is always a single table with a single column, `_value`. + +```js +import "influxdata/influxdb/v1" + +v1.fieldKeys( + bucket: "example-bucket", + predicate: (r) => true, + start: -30d +) +``` + +## Parameters + +### bucket +The bucket to list field keys from. + +_**Data type:** String_ + +### predicate +The predicate function that filters field keys. +_Defaults to `(r) => true`._ + +_**Data type:** Function_ + +### start +The oldest 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](/influxdb/v2.0/reference/flux/language/types/#time-types). + +_**Data type:** Duration_ + +## Examples +```js +import "influxdata/influxdb/v1" + +v1.fieldKeys(bucket: "my-bucket") +``` + +## Function definition +```js +package v1 + +fieldKeys = (bucket, predicate=(r) => true, start=-30d) => + tagValues(bucket: bucket, tag: "_field", predicate: predicate, start: start) +``` + +_**Used functions:** +[v1.tagValues](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues/)_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/fieldsascols.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/fieldsascols.md new file mode 100644 index 000000000..c9b623630 --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/fieldsascols.md @@ -0,0 +1,61 @@ +--- +title: v1.fieldsAsCols() function +description: The v1.fieldsAsCols() function pivots a table to automatically align fields within each input table that have the same timestamp. +aliases: + - /influxdb/v2.0/reference/flux/functions/inputs/fromrows + - /influxdb/v2.0/reference/flux/functions/transformations/influxfieldsascols + - /influxdb/v2.0/reference/flux/functions/influxdb-v1/fieldsascols/ + - /influxdb/v2.0/reference/flux/functions/influxdb-schema/fieldsascols/ +menu: + influxdb_2_0_ref: + name: v1.fieldsAsCols + parent: InfluxDB v1 +weight: 301 +introduced: 0.16.0 +deprecated: 0.88.0 +--- + +{{% warn %}} +`v1.fieldsAsCols()` was deprecated in **Flux v0.88.0** in favor of +[`schema.fieldsAsCols()`](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldsascols/). +{{% /warn %}} + +The `v1.fieldsAsCols()` function is a special application of the +[`pivot()`](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/pivot/) +function that pivots on `_field` and `_time` columns to aligns fields within each +input table that have the same timestamp. and resemble InfluxDB 1.x query output. + +_**Function type:** Transformation_ + +```js +import "influxdata/influxdb/v1" + +v1.fieldsAsCols() +``` + +## Examples +```js +import "influxdata/influxdb/v1" + +from(bucket:"example-bucket") + |> range(start: -1h) + |> filter(fn: (r) => r._measurement == "cpu") + |> v1.fieldsAsCols() + |> keep(columns: ["_time", "cpu", "usage_idle", "usage_user"]) +``` + +## Function definition +```js +package v1 + +fieldsAsCols = (tables=<-) => + tables + |> pivot( + rowKey:["_time"], + columnKey: ["_field"], + valueColumn: "_value" + ) +``` + +_**Used functions:** +[pivot()](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/pivot)_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementfieldkeys.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementfieldkeys.md new file mode 100644 index 000000000..3aa6d05da --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementfieldkeys.md @@ -0,0 +1,78 @@ +--- +title: v1.measurementFieldKeys() function +description: The `v1.measurementFieldKeys()` function returns a list of fields in a measurement. +menu: + influxdb_2_0_ref: + name: v1.measurementFieldKeys + parent: InfluxDB v1 +weight: 301 +influxdb/v2.0/tags: [fields] +aliases: + - /influxdb/v2.0/reference/flux/functions/influxdb-v1/measurementfieldkeys/ +related: + - /influxdb/v2.0/query-data/flux/explore-schema/ + - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-field-keys, SHOW FIELD KEYS in InfluxQL +introduced: 0.68.0 +deprecated: 0.88.0 +--- + +{{% warn %}} +`v1.measurementFieldKeys()` was deprecated in **Flux v0.88.0** in favor of +[`schema.measurementFieldKeys()`](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementfieldkeys/). +{{% /warn %}} + +The `v1.measurementFieldKeys()` function returns a list of fields in a measurement. +The return value is always a single table with a single column, `_value`. + +```js +import "influxdata/influxdb/v1" + +v1.measurementFieldKeys( + bucket: "example-bucket", + measurement: "example-measurement", + start: -30d +) +``` + +## Parameters + +### bucket +Bucket to retrieve field keys from. + +_**Data type:** String_ + +### measurement +Measurement to list field keys from. + +_**Data type:** String_ + +### start +Oldest 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](/influxdb/v2.0/reference/flux/language/types/#time-types). + +_**Data type:** Duration_ + +## Examples +```js +import "influxdata/influxdb/v1" + +v1.measurementFieldKeys( + bucket: "telegraf", + measurement: "cpu", +) +``` + +## Function definition +```js +package v1 + +measurementFieldKeys = (bucket, measurement, start=-30d) => + fieldKeys(bucket: bucket, predicate: (r) => r._measurement == measurement, start: start) +``` + +_**Used functions:** +[v1.fieldKeys](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/fieldkeys/)_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurements.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurements.md new file mode 100644 index 000000000..4ecd50094 --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurements.md @@ -0,0 +1,49 @@ +--- +title: v1.measurements() function +description: The v1.measurements() function returns a list of measurements in a specific bucket. +aliases: + - /influxdb/v2.0/reference/flux/functions/influxdb-v1/measurements/ +menu: + influxdb_2_0_ref: + name: v1.measurements + parent: InfluxDB v1 +weight: 301 +influxdb/v2.0/tags: [measurements] +related: + - /influxdb/v2.0/query-data/flux/explore-schema/ + - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-measurements, SHOW MEASUREMENTS in InfluxQL +introduced: 0.16.0 +deprecated: 0.88.0 +--- + +{{% warn %}} +`v1.measurements()` was deprecated in **Flux v0.88.0** in favor of +[`schema.measurements()`](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurements/). +{{% /warn %}} + +The `v1.measurements()` function returns a list of measurements in a specific bucket. +The return value is always a single table with a single column, `_value`. + +```js +import "influxdata/influxdb/v1" + +v1.measurements(bucket: "example-bucket") +``` + +## Parameters + +### bucket +Bucket to retrieve measurements from. + +_**Data type:** String_ + +## Function definition +```js +package v1 + +measurements = (bucket) => + tagValues(bucket: bucket, tag: "_measurement") +``` + +_**Used functions:** +[v1.tagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues)_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagkeys.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagkeys.md new file mode 100644 index 000000000..418a6f926 --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagkeys.md @@ -0,0 +1,60 @@ +--- +title: v1.measurementTagKeys() function +description: The v1.measurementTagKeys() function returns a list of tag keys for a specific measurement. +aliases: + - /influxdb/v2.0/reference/flux/functions/influxdb-v1/measurementtagkeys/ +menu: + influxdb_2_0_ref: + name: v1.measurementTagKeys + parent: InfluxDB v1 +weight: 301 +influxdb/v2.0/tags: [tags] +related: + - /influxdb/v2.0/query-data/flux/explore-schema/ + - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-tag-keys, SHOW TAG KEYS in InfluxQL +introduced: 0.16.0 +deprecated: 0.88.0 +--- + +{{% warn %}} +`v1.measurementTagKeys()` was deprecated in **Flux v0.88.0** in favor of +[`schema.measurementTagKeys()`](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagkeys/). +{{% /warn %}} + +The `v1.measurementTagKeys()` function returns a list of tag keys for a specific measurement. +The return value is always a single table with a single column, `_value`. + +```js +import "influxdata/influxdb/v1" + +v1.measurementTagKeys( + bucket: "example-bucket", + measurement: "cpu" +) +``` + +## Parameters + +### bucket +Bucket to return tag keys from for a specific measurement. + +_**Data type:** String_ + +### measurement +Measurement to return tag keys from. + +_**Data type:** String_ + +## Function definition +```js +package v1 + +measurementTagKeys = (bucket, measurement) => + tagKeys( + bucket: bucket, + predicate: (r) => r._measurement == measurement + ) +``` + +_**Used functions:** +[v1.tagKeys()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagkeys)_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagvalues.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagvalues.md new file mode 100644 index 000000000..a3f549b8b --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagvalues.md @@ -0,0 +1,68 @@ +--- +title: v1.measurementTagValues() function +description: The v1.measurementTagValues() function returns a list of tag values for a specific measurement. +aliases: + - /influxdb/v2.0/reference/flux/functions/influxdb-v1/measurementtagvalues/ +menu: + influxdb_2_0_ref: + name: v1.measurementTagValues + parent: InfluxDB v1 +weight: 301 +influxdb/v2.0/tags: [tags] +related: + - /influxdb/v2.0/query-data/flux/explore-schema/ + - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-tag-values, SHOW TAG VALUES in InfluxQL +introduced: 0.16.0 +deprecated: 0.88.0 +--- + +{{% warn %}} +`v1.measurementTagValues()` was deprecated in **Flux v0.88.0** in favor of +[`schema.measurementTagValues()`](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagvalues/). +{{% /warn %}} + +The `v1.measurementTagValues()` function returns a list of tag values for a specific measurement. +The return value is always a single table with a single column, `_value`. + +```js +import "influxdata/influxdb/v1" + +v1.measurementTagValues( + bucket: "example-bucket", + measurement: "cpu", + tag: "host" +) +``` + +## Parameters + +## bucket +Bucket to return tag values from for a specific measurement. + +_**Data type:** String_ + +### measurement +Measurement to return tag values from. + +_**Data type:** String_ + +### tag +Tag to return all unique values from. + +_**Data type:** String_ + + +## Function definition +```js +package v1 + +measurementTagValues = (bucket, measurement, tag) => + tagValues( + bucket: bucket, + tag: tag, + predicate: (r) => r._measurement == measurement + ) +``` + +_**Used functions:** +[v1.tagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues)_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagkeys.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagkeys.md new file mode 100644 index 000000000..858a510b9 --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagkeys.md @@ -0,0 +1,87 @@ +--- +title: v1.tagKeys() function +description: The v1.tagKeys() function returns a list of tag keys for all series that match the predicate. +aliases: + - /influxdb/v2.0/reference/flux/functions/influxdb-v1/tagkeys/ +menu: + influxdb_2_0_ref: + name: v1.tagKeys + parent: InfluxDB v1 +weight: 301 +influxdb/v2.0/tags: [tags] +related: + - /influxdb/v2.0/query-data/flux/explore-schema/ + - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-tag-keys, SHOW TAG KEYS in InfluxQL +introduced: 0.16.0 +deprecated: 0.88.0 +--- + +{{% warn %}} +`v1.tagkeys()` was deprecated in **Flux v0.88.0** in favor of +[`schema.tagkeys()`](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagkeys/). +{{% /warn %}} + +The `v1.tagKeys()` function returns a list of tag keys for all series that match the [`predicate`](#predicate). +The return value is always a single table with a single column, `_value`. + +```js +import "influxdata/influxdb/v1" + +v1.tagKeys( + bucket: "example-bucket", + predicate: (r) => true, + start: -30d +) +``` + +## Parameters + +### bucket +Bucket to return tag keys from. + +_**Data type:** String_ + +### predicate +Predicate function that filters tag keys. +_Defaults to `(r) => true`._ + +_**Data type:** Function_ + +### start +Oldest 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](/influxdb/v2.0/reference/flux/language/types/#time-types). + +_**Data type:** Duration_ + +## Examples +```js +import "influxdata/influxdb/v1" + +v1.tagKeys(bucket: "my-bucket") +``` + + +## Function definition +```js +package v1 + +tagKeys = (bucket, predicate=(r) => true, start=-30d) => + from(bucket: bucket) + |> range(start: start) + |> filter(fn: predicate) + |> keys() + |> keep(columns: ["_value"]) + |> distinct() +``` + +_**Used functions:** +[from](/influxdb/v2.0/reference/flux/stdlib/built-in/inputs/from/), +[range](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/range/), +[filter](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/filter/), +[keys](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/keys/), +[keep](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/keep/), +[distinct](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/selectors/distinct/)_ diff --git a/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues.md b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues.md new file mode 100644 index 000000000..4aab95aa2 --- /dev/null +++ b/content/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues.md @@ -0,0 +1,95 @@ +--- +title: v1.tagValues() function +description: The `v1.tagValues()` function returns a list unique values for a given tag. +aliases: + - /influxdb/v2.0/reference/flux/functions/influxdb-v1/tagvalues/ +menu: + influxdb_2_0_ref: + name: v1.tagValues + parent: InfluxDB v1 +weight: 301 +influxdb/v2.0/tags: [tags] +related: + - /influxdb/v2.0/query-data/flux/explore-schema/ + - /{{< latest "influxdb" "v1" >}}/query_language/schema_exploration#show-tag-values, SHOW TAG VALUES in InfluxQL +introduced: 0.16.0 +deprecated: 0.88.0 +--- + +{{% warn %}} +`v1.tagValues()` was deprecated in **Flux v0.88.0** in favor of +[`schema.tagValues()`](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues/). +{{% /warn %}} + +The `v1.tagValues()` function returns a list of unique values for a given tag. +The return value is always a single table with a single column, `_value`. + +```js +import "influxdata/influxdb/v1" + +v1.tagValues( + bucket: "example-bucket", + tag: "host", + predicate: (r) => true, + start: -30d +) +``` + +## Parameters + +### bucket +Bucket to return unique tag values from. + +_**Data type:** String_ + +### tag +Tag to return unique values from. + +_**Data type:** String_ + +### predicate +Predicate function that filters tag values. +_Defaults to `(r) => true`._ + +_**Data type:** Function_ + +### start +Oldest 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](/influxdb/v2.0/reference/flux/language/types/#time-types). + +_**Data type:** Duration_ + +## Examples +```js +import "influxdata/influxdb/v1" + +v1.tagValues( + bucket: "my-bucket", + tag: "host", +) +``` + +## Function definition +```js +package v1 + +tagValues = (bucket, tag, predicate=(r) => true, start=-30d) => + from(bucket: bucket) + |> range(start: start) + |> filter(fn: predicate) + |> group(columns: [tag]) + |> distinct(column: tag) + |> keep(columns: ["_value"]) +``` + +_**Used functions:** +[from](/influxdb/v2.0/reference/flux/stdlib/built-in/inputs/from/), +[range](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/range/), +[filter](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/filter/), +[group](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/group/), +[distinct](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/selectors/distinct/), +[keep](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/keep/)_ diff --git a/content/influxdb/v2.0/reference/release-notes/flux.md b/content/influxdb/v2.0/reference/release-notes/flux.md index 1d0988c34..d0627cc1f 100644 --- a/content/influxdb/v2.0/reference/release-notes/flux.md +++ b/content/influxdb/v2.0/reference/release-notes/flux.md @@ -1644,7 +1644,7 @@ In Flux 0.39.0, `holtWinters()` can cause the query engine to panic. --- -##v0.16.0 [2019-01-17] +## v0.16.0 [2019-01-17] ### Features - Adds various v1 meta queries helper functions diff --git a/content/influxdb/v2.0/visualize-data/variables/common-variables.md b/content/influxdb/v2.0/visualize-data/variables/common-variables.md index f0b936701..ff8d002cb 100644 --- a/content/influxdb/v2.0/visualize-data/variables/common-variables.md +++ b/content/influxdb/v2.0/visualize-data/variables/common-variables.md @@ -26,23 +26,25 @@ buckets() ## List measurements List all measurements in a specified bucket. -_**Flux package:** [InfluxDB v1](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/) -**Flux functions:** [v1.measurements()](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurements/)_ +_**Flux package:** [InfluxDB schema](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/) +**Flux functions:** [schema.measurements()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurements/)_ ```js -import "influxdata/influxdb/v1" -v1.measurements(bucket: "bucket-name") +import "influxdata/influxdb/schema" + +schema.measurements(bucket: "bucket-name") ``` ## List fields in a measurement List all fields in a specified bucket and measurement. -_**Flux package:** [InfluxDB v1](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/) -**Flux functions:** [v1.measurementTagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagvalues/)_ +_**Flux package:** [InfluxDB schema](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/) +**Flux functions:** [schema.measurementTagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagvalues/)_ ```js -import "influxdata/influxdb/v1" -v1.measurementTagValues( +import "influxdata/influxdb/schema" + +schema.measurementTagValues( bucket: "bucket-name", measurement: "measurment-name", tag: "_field" @@ -53,36 +55,39 @@ v1.measurementTagValues( List all unique tag values for a specific tag in a specified bucket. The example below lists all unique values of the `host` tag. -_**Flux package:** [InfluxDB v1](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/)_ -_**Flux functions:** [v1.tagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues/)_ +_**Flux package:** [InfluxDB schema](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/)_ +_**Flux functions:** [schema.tagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues/)_ ```js -import "influxdata/influxdb/v1" -v1.tagValues(bucket: "bucket-name", tag: "host") +import "influxdata/influxdb/schema" + +schema.tagValues(bucket: "bucket-name", tag: "host") ``` ## List Docker containers List all Docker containers when using the Docker Telegraf plugin. _**Telegraf plugin:** [Docker](/{{< latest "telegraf" >}}/plugins/inputs/#docker)_ -_**Flux package:** [InfluxDB v1](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/)_ -_**Flux functions:** [v1.tagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues/)_ +_**Flux package:** [InfluxDB schema](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/)_ +_**Flux functions:** [schema.tagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/tagvalues/)_ ```js -import "influxdata/influxdb/v1" -v1.tagValues(bucket: "bucket-name", tag: "container_name") +import "influxdata/influxdb/schema" + +schema.tagValues(bucket: "bucket-name", tag: "container_name") ``` ## List Kubernetes pods List all Kubernetes pods when using the Kubernetes Telegraf plugin. _**Telegraf plugin:** [Kubernetes](/{{< latest "telegraf" >}}/plugins/inputs/#kubernetes)_ -_**Flux package:** [InfluxDB v1](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/)_ -_**Flux functions:** [v1.measurementTagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagvalues/)_ +_**Flux package:** [InfluxDB schema](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/)_ +_**Flux functions:** [schema.measurementTagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagvalues/)_ ```js -import "influxdata/influxdb/v1" -v1.measurementTagValues( +import "influxdata/influxdb/schema" + +schema.measurementTagValues( bucket: "bucket-name", measurement: "kubernetes_pod_container", tag: "pod_name" @@ -93,12 +98,13 @@ v1.measurementTagValues( List all Kubernetes nodes when using the Kubernetes Telegraf plugin. _**Telegraf plugin:** [Kubernetes](/{{< latest "telegraf" >}}/plugins/inputs/#kubernetes)_ -_**Flux package:** [InfluxDB v1](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/)_ -_**Flux functions:** [v1.measurementTagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagvalues/)_ +_**Flux package:** [InfluxDB schema](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/)_ +_**Flux functions:** [schema.measurementTagValues()](/influxdb/v2.0/reference/flux/stdlib/influxdb-schema/measurementtagvalues/)_ ```js -import "influxdata/influxdb/v1" -v1.measurementTagValues( +import "influxdata/influxdb/schema" + +schema.measurementTagValues( bucket: "bucket-name", measurement: "kubernetes_node", tag: "node_name"