Merge branch 'master' into beta-12

pull/1097/head
Scott Anderson 2020-06-09 14:52:25 -06:00
commit 75499d038a
63 changed files with 877 additions and 198 deletions

View File

@ -1,16 +0,0 @@
---
title: Manage multiple members
description: >
View and manage multiple members in an InfluxDB Cloud account.
weight: 4
menu:
v2_0:
parent: Account management
name: Manage multiple members
---
{{< cloud-name >}} accounts support multiple members in an organization.
Collaborate with others using these features.
By default, each member has full permissions on resources in your organization.
{{< children >}}

View File

@ -1,28 +0,0 @@
---
title: Invite a member
list_title: Invite a member
description: >
Invite a member to collaborate in InfluxDB Cloud.
weight: 103
menu:
v2_0:
parent: Manage multiple members
name: Invite a member
---
1. Navigate to the **Members** page under **Organizations** in the left navigation bar.
{{< nav-icon "org" >}}
2. Under **Add a new member to your organization**, enter the email address of the member to invite.
(Members must be invited one at a time.)
3. Click **Add & Invite**.
An invitation with an activation link is sent to the specified email address.
The activation link expires after 72 hours.
Once activated, the new member is added as an **Owner** with permissions to read and write all resources.
{{% warn %}}
Currently, Cloud 2.0 has only one permission level: Owner.
With Owner permissions, a member can delete resources and other members from your organization.
Take care when inviting a member.
{{% /warn %}}

View File

@ -1,16 +0,0 @@
---
title: Remove a member
seotitle: Remove a member from your InfluxDB Cloud organization
description: >
Remove a member from an InfluxDB Cloud organization.
weight: 103
menu:
v2_0:
parent: Manage multiple members
identifier: remove_member_cloud
---
1. Navigate to the **Members** page under **Organizations** in the left navigation bar.
{{< nav-icon "org" >}}
2. Click the {{< icon "delete" >}} next to the member you want to remove.
3. Confirm the removal.

View File

@ -0,0 +1,16 @@
---
title: Manage multiple users
description: >
View and manage multiple users in an InfluxDB Cloud account.
weight: 4
menu:
v2_0:
parent: Account management
name: Manage multiple users
---
{{< cloud-name >}} accounts support multiple users in an organization.
Collaborate with others using these features.
By default, each user has full permissions on resources in your organization.
{{< children >}}

View File

@ -0,0 +1,27 @@
---
title: Invite a user
list_title: Invite a user
description: >
Invite a user to collaborate in InfluxDB Cloud.
weight: 103
menu:
v2_0:
parent: Manage multiple users
identifier: invite_user_cloud
---
1. Navigate to the **Users** page in the left navigation bar.
2. Under **Add a new user to your organization**, enter the email address of the user to invite.
(Users must be invited one at a time.)
3. Click **Add & Invite**.
An invitation with an activation link is sent to the specified email address.
The activation link expires after 72 hours.
Once activated, the new user is added as an **Owner** with permissions to read and write all resources.
{{% warn %}}
Currently, Cloud 2.0 has only one permission level: Owner.
With Owner permissions, a user can delete resources and other users from your organization.
Take care when inviting a user.
{{% /warn %}}

View File

@ -0,0 +1,15 @@
---
title: Remove a user
seotitle: Remove a user from your InfluxDB Cloud organization
description: >
Remove a user from an InfluxDB Cloud organization.
weight: 103
menu:
v2_0:
parent: Manage multiple users
identifier: remove_user_cloud
---
1. Navigate to the **Users** page in the left navigation bar.
2. Click the {{< icon "delete" >}} next to the user you want to remove.
3. Confirm the removal.

View File

@ -382,17 +382,17 @@ You are ready to [write or collect data](/v2.0/write-data).
{{% note %}} {{% note %}}
#### Using the influx CLI after setting up InfluxDB through the UI #### Using the influx CLI after setting up InfluxDB through the UI
To use the [`influx` CLI](/v2.0/reference/cli/influx) after setting up InfluxDB through the UI, To use the [`influx` CLI](/v2.0/reference/cli/influx) after setting up InfluxDB through the UI, provide your [authentication token](/v2.0/users/tokens/), which is automatically generated during the setup process. For instructions on viewing your token via CLI or UI, see [View tokens](/v2.0/security/tokens/view-tokens/).
use one of the following methods to provide your [authentication token](/v2.0/users/tokens/) to the CLI:
1. Pass your token to the `influx` CLI using the `-t` or `--token` flag. Use one of the following methods to provide your authentication token to the CLI:
2. Set the `INFLUX_TOKEN` environment variable using your token.
- Create a new InfluxDB connection configuration using the [`influx config create` command](/v2.0/reference/cli/influx/config/create/).
- Pass your token to the `influx` CLI using the `-t` or `--token` flag.
- Set the `INFLUX_TOKEN` environment variable using your token.
```bash ```bash
export INFLUX_TOKEN=oOooYourAuthTokenOoooOoOO== export INFLUX_TOKEN=oOooYourAuthTokenOoooOoOO==
``` ```
3. Store your token in `~/.influxdbv2/credentials`.
_The content of the `credentials` file should be only your token._
_See [View tokens](/v2.0/security/tokens/view-tokens/) for information about _See [View tokens](/v2.0/security/tokens/view-tokens/) for information about
retrieving authentication tokens._ retrieving authentication tokens._
@ -419,7 +419,10 @@ influx setup
Enter nothing for an infinite retention period. Enter nothing for an infinite retention period.
7. Confirm the details for your primary user, organization, and bucket. 7. Confirm the details for your primary user, organization, and bucket.
InfluxDB is now initialized with a primary user, organization, and bucket. InfluxDB is now initialized with a primary user, organization, bucket, and authentication token. It has also create a config profile for you so that you don't have to add organization and token to every command. To view that config profile, use the [`influx config list`](/v2.0/reference/cli/influx/config) command.
To continue to use InfluxDB via the CLI, you need the authentication token created during setup. To view the token, log into the UI with the credentials created above. (For instructions, see [View tokens in the InfluxDB UI](/v2.0/security/tokens/view-tokens/#view-tokens-in-the-influxdb-ui).)
You are ready to [write or collect data](/v2.0/write-data). You are ready to [write or collect data](/v2.0/write-data).
{{% note %}} {{% note %}}
@ -489,10 +492,7 @@ The primary differences between InfluxDB OSS 2.0 and InfluxDB Cloud 2.0 are:
- [InfluxDB scrapers](/v2.0/write-data/scrape-data/) that collect data from specified - [InfluxDB scrapers](/v2.0/write-data/scrape-data/) that collect data from specified
targets are not available in {{< cloud-name "short" >}}. targets are not available in {{< cloud-name "short" >}}.
- {{< cloud-name "short" >}} instances are currently limited to a single organization with a single user. - {{< cloud-name "short" >}} instances are currently limited to a single organization.
- **InfluxDB Cloud** does not support retrieving data from a file based CSV source
using the `file` parameter of the [`csv.from()`](/v2.0/reference/flux/functions/csv/from);
however you can use raw CSV data with the `csv` parameter.
#### New features in InfluxDB Cloud 2.0 #### New features in InfluxDB Cloud 2.0

View File

@ -9,7 +9,7 @@ menu:
v2_0: v2_0:
name: Calculate percentages name: Calculate percentages
parent: Query with Flux parent: Query with Flux
weight: 206 weight: 209
aliases: aliases:
- /v2.0/query-data/guides/manipulate-timestamps/ - /v2.0/query-data/guides/manipulate-timestamps/
related: related:
@ -201,7 +201,7 @@ pgHost = secrets.get(key: "POSTGRES_HOST")
t1 = sql.from( t1 = sql.from(
driverName: "postgres", driverName: "postgres",
dataSourceName: "postgresql://${pgUser}:${pgPass}@${pgHost}", dataSourceName: "postgresql://${pgUser}:${pgPass}@${pgHost}",
query:"SELECT id, name, available FROM exampleTable" query:"SELECT id, name, available FROM example_table"
) )
t2 = from(bucket: "example-bucket") t2 = from(bucket: "example-bucket")

View File

@ -0,0 +1,140 @@
---
title: Explore your data schema with Flux
list_title: Explore your schema
description: >
Flux provides functions that let you explore the structure and schema of your
data stored in InfluxDB.
v2.0/tags: [schema]
menu:
v2_0:
name: Explore your schema
parent: Query with Flux
weight: 206
related:
- /v2.0/reference/flux/stdlib/built-in/inputs/buckets/
- /v2.0/reference/flux/stdlib/influxdb-v1/measurements
- /v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys
- /v2.0/reference/flux/stdlib/influxdb-v1/measurementfieldkeys
- /v2.0/reference/flux/stdlib/influxdb-v1/tagkeys
- /v2.0/reference/flux/stdlib/influxdb-v1/measurementtagkeys
- /v2.0/reference/flux/stdlib/influxdb-v1/tagvalues
- /v2.0/reference/flux/stdlib/influxdb-v1/measurementtagvalues
list_code_example: |
```js
import "influxdata/influxdb/v1"
// List buckets
buckets()
// List measurements
v1.measurements(bucket: "example-bucket")
// List field keys
v1.fieldKeys(bucket: "example-bucket")
// List tag keys
v1.tagKeys(bucket: "example-bucket")
// List tag values
v1.tagValues(bucket: "example-bucket", tag: "example-tag")
```
---
Flux provides functions that let you explore the structure and schema of your
data stored in InfluxDB.
- [List buckets](#list-buckets)
- [List measurements](#list-measurements)
- [List field keys](#list-field-keys)
- [List tag keys](#list-tag-keys)
- [List tag values](#list-tag-values)
## List buckets
Use the [`buckets()` function](/v2.0/reference/flux/stdlib/built-in/inputs/buckets/)
to list **buckets in your organization**.
```js
buckets()
```
## List measurements
Use the [`v1.measurements()` function](/v2.0/reference/flux/stdlib/influxdb-v1/measurements)
to list **measurements in a bucket**.
```js
import "influxdata/influxdb/v1"
v1.measurements(bucket: "example-bucket")
```
## List field keys
Use the [`v1.fieldKeys` function](/v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys)
to list **field keys in a bucket**.
```js
import "influxdata/influxdb/v1"
v1.fieldKeys(bucket: "example-bucket")
```
### List fields in a measurement
Use the [`v1.measurementFieldKeys` function](/v2.0/reference/flux/stdlib/influxdb-v1/measurementfieldkeys)
to list **field keys in a measurement**.
```js
import "influxdata/influxdb/v1"
v1.measurementFieldKeys(
bucket: "example-bucket",
measurement: "example-measurement"
)
```
## List tag keys
Use the [`v1.tagKeys()` function](/v2.0/reference/flux/stdlib/influxdb-v1/tagkeys)
to list **tag keys in a bucket**.
```js
import "influxdata/influxdb/v1"
v1.tagKeys(bucket: "example-bucket")
```
### List tag keys in a measurement
Use the [`v1.measurementTagKeys` function](/v2.0/reference/flux/stdlib/influxdb-v1/measurementtagkeys)
to list **tag keys in a measurement**.
_This function returns results from the last 30 days._
```js
import "influxdata/influxdb/v1"
v1.measurementTagKeys(
bucket: "example-bucket",
measurement: "example-measurement"
)
```
## List tag values
Use the [`v1.tagValues()` function](/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues)
to list **tag values for a given tag in a bucket**.
```js
import "influxdata/influxdb/v1"
v1.tagValues(bucket: "example-bucket", tag: "example-tag")
```
### List tag values in a measurement
Use the [`v1.measurementTagValues` function](/v2.0/reference/flux/stdlib/influxdb-v1/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"
v1.measurementTagValues(
bucket: "example-bucket",
tag: "example-tag",
measurement: "example-measurement"
)
```

View File

@ -10,7 +10,7 @@ menu:
v2_0: v2_0:
name: Transform data with math name: Transform data with math
parent: Query with Flux parent: Query with Flux
weight: 205 weight: 208
aliases: aliases:
- /v2.0/query-data/guides/mathematic-operations/ - /v2.0/query-data/guides/mathematic-operations/
related: related:
@ -221,7 +221,7 @@ pgHost = secrets.get(key: "POSTGRES_HOST")
t1 = sql.from( t1 = sql.from(
driverName: "postgres", driverName: "postgres",
dataSourceName: "postgresql://${pgUser}:${pgPass}@${pgHost}", dataSourceName: "postgresql://${pgUser}:${pgPass}@${pgHost}",
query:"SELECT id, name, available FROM exampleTable" query:"SELECT id, name, available FROM example_table"
) )
t2 = from(bucket: "example-bucket") t2 = from(bucket: "example-bucket")

View File

@ -32,9 +32,9 @@ This lets you, for example, dynamically set variables using query results.
**To extract scalar values from output:** **To extract scalar values from output:**
1. [Extract a table](#extract-a-table). 1. [Extract a column from the input stream](#extract-a-column)
2. [Extract a column from the table](#extract-a-column-from-the-table) _**or**_ [extract a row from the input stream](#extract-a-row).
_**or**_ [extract a row from the table](#extract-a-row-from-the-table). 2. Use the returned array or object to reference scalar values.
_The samples on this page use the [sample data provided below](#sample-data)._ _The samples on this page use the [sample data provided below](#sample-data)._
@ -48,61 +48,33 @@ _The samples on this page use the [sample data provided below](#sample-data)._
See [#15321](https://github.com/influxdata/influxdb/issues/15231). See [#15321](https://github.com/influxdata/influxdb/issues/15231).
{{% /warn %}} {{% /warn %}}
## Extract a table ## Table extraction
Flux formats query results as a stream of tables. Flux formats query results as a stream of tables.
To extract a scalar value from a stream of tables, you must first extract a single table. Both [`findColumn()`](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/findcolumn/)
and [`findRecord()`](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/findrecord/)
to extract a single table from the stream of tables. extract the first table in a stream of tables whose [group key](/v2.0/reference/glossary/#group-key)
values match the `fn` [predicate function](/v2.0/reference/glossary/#predicate-function).
{{% note %}}
If query results include only one table, it is still formatted as a stream of tables.
You still must extract that table from the stream.
{{% /note %}}
Use [`tableFind()`](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/tablefind/)
to extract the **first** table whose [group key](/v2.0/reference/glossary/#group-key)
values match the `fn` [predicate function](/v2.0/reference/glossary/#predicate-expression).
The predicate function requires a `key` object, which represents the group key of
each table.
```js
sampleData
|> tableFind(fn: (key) =>
key._field == "temp" and
key.location == "sfo"
)
```
The example above returns a single table:
| _time | location | _field | _value |
|:----- |:--------:|:------:| ------:|
| 2019-11-01T12:00:00Z | sfo | temp | 65.1 |
| 2019-11-01T13:00:00Z | sfo | temp | 66.2 |
| 2019-11-01T14:00:00Z | sfo | temp | 66.3 |
| 2019-11-01T15:00:00Z | sfo | temp | 66.8 |
{{% note %}} {{% note %}}
#### Extract the correct table #### Extract the correct table
Flux functions do not guarantee table order and `tableFind()` returns only the Flux functions do not guarantee table order.
**first** table that matches the `fn` predicate. `findColumn()` and `findRecord` extract only the **first** table that matches the `fn` predicate.
To extract the table that includes the data you actually want, be very specific in To extract the correct table, be very specific in your predicate function or
your predicate function or filter and transform your data to minimize the number filter and transform your data to minimize the number of tables piped-forward into the functions.
of tables piped-forward into `tableFind()`.
{{% /note %}} {{% /note %}}
## Extract a column from the table ## Extract a column
Use the [`getColumn()` function](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/getcolumn/) Use the [`findColumn()` function](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/findcolumn/)
to output an array of values from a specific column in the extracted table. to output an array of values from a specific column in the extracted table.
_See [Sample data](#sample-data) below._
```js ```js
sampleData sampleData
|> tableFind(fn: (key) => |> findColumn(
key._field == "temp" and fn: (key) => key._field == "temp" and key.location == "sfo",
key.location == "sfo" column: "_value"
) )
|> getColumn(column: "_value")
// Returns [65.1, 66.2, 66.3, 66.8] // Returns [65.1, 66.2, 66.3, 66.8]
``` ```
@ -113,13 +85,14 @@ In the example below, `SFOTemps` represents the array of values.
Reference a specific index (integer starting from `0`) in the array to return the Reference a specific index (integer starting from `0`) in the array to return the
value at that index. value at that index.
_See [Sample data](#sample-data) below._
```js ```js
SFOTemps = sampleData SFOTemps = sampleData
|> tableFind(fn: (key) => |> findColumn(
key._field == "temp" and fn: (key) => key._field == "temp" and key.location == "sfo",
key.location == "sfo" column: "_value"
) )
|> getColumn(column: "_value")
SFOTemps SFOTemps
// Returns [65.1, 66.2, 66.3, 66.8] // Returns [65.1, 66.2, 66.3, 66.8]
@ -131,19 +104,18 @@ SFOTemps[2]
// Returns 66.3 // Returns 66.3
``` ```
## Extract a row from the table ## Extract a row
Use the [`getRecord()` function](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/getrecord/) Use the [`findRecord()` function](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/findrecord/)
to output data from a single row in the extracted table. to output data from a single row in the extracted table.
Specify the index of the row to output using the `idx` parameter. Specify the index of the row to output using the `idx` parameter.
The function outputs an object with key-value pairs for each column. The function outputs an object with key-value pairs for each column.
```js ```js
sampleData sampleData
|> tableFind(fn: (key) => |> findRecord(
key._field == "temp" and fn: (key) => key._field == "temp" and key.location == "sfo",
key.location == "sfo" idx: 0
) )
|> getRecord(idx: 0)
// Returns { // Returns {
// _time:2019-11-11T12:00:00Z, // _time:2019-11-11T12:00:00Z,
@ -161,11 +133,10 @@ keys in the object.
```js ```js
tempInfo = sampleData tempInfo = sampleData
|> tableFind(fn: (key) => |> findRecord(
key._field == "temp" and fn: (key) => key._field == "temp" and key.location == "sfo",
key.location == "sfo" idx: 0
) )
|> getRecord(idx: 0)
tempInfo tempInfo
// Returns { // Returns {
@ -190,8 +161,10 @@ Create custom helper functions to extract scalar values from query output.
// Define a helper function to extract field values // Define a helper function to extract field values
getFieldValue = (tables=<-, field) => { getFieldValue = (tables=<-, field) => {
extract = tables extract = tables
|> tableFind(fn: (key) => key._field == field) |> findColumn(
|> getColumn(column: "_value") fn: (key) => key._field == field,
column: "_value"
)
return extract[0] return extract[0]
} }
@ -210,8 +183,10 @@ lastJFKTemp
// Define a helper function to extract a row as an object // Define a helper function to extract a row as an object
getRow = (tables=<-, field, idx=0) => { getRow = (tables=<-, field, idx=0) => {
extract = tables extract = tables
|> tableFind(fn: (key) => true) |> findRecord(
|> getRecord(idx: idx) fn: (key) => true,
idx: idx
)
return extract return extract
} }

View File

@ -4,7 +4,7 @@ seotitle: Query SQL data sources with InfluxDB
list_title: Query SQL data list_title: Query SQL data
description: > description: >
The Flux `sql` package provides functions for working with SQL data sources. The Flux `sql` package provides functions for working with SQL data sources.
Use `sql.from()` to query SQL databases like PostgreSQL and MySQL Use `sql.from()` to query SQL databases like PostgreSQL, MySQL, Snowflake, and SQLite.
v2.0/tags: [query, flux, sql] v2.0/tags: [query, flux, sql]
menu: menu:
v2_0: v2_0:
@ -30,8 +30,8 @@ list_code_example: |
The [Flux](/v2.0/reference/flux) `sql` package provides functions for working with SQL data sources. The [Flux](/v2.0/reference/flux) `sql` package provides functions for working with SQL data sources.
[`sql.from()`](/v2.0/reference/flux/stdlib/sql/from/) lets you query SQL data sources [`sql.from()`](/v2.0/reference/flux/stdlib/sql/from/) lets you query SQL data sources
like [PostgreSQL](https://www.postgresql.org/), [MySQL](https://www.mysql.com/), like [PostgreSQL](https://www.postgresql.org/), [MySQL](https://www.mysql.com/),
and [SQLite](https://www.sqlite.org/index.html), and use the results with InfluxDB [Snowflake](https://www.snowflake.com/), and [SQLite](https://www.sqlite.org/index.html),
dashboards, tasks, and other operations. and use the results with InfluxDB dashboards, tasks, and other operations.
- [Query a SQL data source](#query-a-sql-data-source) - [Query a SQL data source](#query-a-sql-data-source)
- [Join SQL data with data in InfluxDB](#join-sql-data-with-data-in-influxdb) - [Join SQL data with data in InfluxDB](#join-sql-data-with-data-in-influxdb)
@ -55,6 +55,7 @@ To query a SQL data source:
{{% code-tabs %}} {{% code-tabs %}}
[PostgreSQL](#) [PostgreSQL](#)
[MySQL](#) [MySQL](#)
[Snowflake](#)
[SQLite](#) [SQLite](#)
{{% /code-tabs %}} {{% /code-tabs %}}
@ -82,6 +83,18 @@ sql.from(
``` ```
{{% /code-tab-content %}} {{% /code-tab-content %}}
{{% code-tab-content %}}
```js
import "sql"
sql.from(
driverName: "snowflake",
dataSourceName: "user:password@account/db/exampleschema?warehouse=wh",
query: "SELECT * FROM example_table"
)
```
{{% /code-tab-content %}}
{{% code-tab-content %}} {{% code-tab-content %}}
```js ```js
// NOTE: InfluxDB OSS and InfluxDB Cloud do not have access to // NOTE: InfluxDB OSS and InfluxDB Cloud do not have access to

View File

@ -0,0 +1,12 @@
---
title: InfluxDB Kotlin client library
list_title: Kotlin
description: Use the Kotlin client library to interact with InfluxDB.
external_url: https://github.com/influxdata/influxdb-client-java/tree/master/client-kotlin
menu:
v2_0_ref:
name: Kotlin
parent: Client libraries
url: https://github.com/influxdata/influxdb-client-java/tree/master/client-kotlin
weight: 201
---

View File

@ -0,0 +1,12 @@
---
title: InfluxDB Scala client library
list_title: Scala
description: Use the Scala client library to interact with InfluxDB.
external_url: https://github.com/influxdata/influxdb-client-java/tree/master/client-scala
menu:
v2_0_ref:
name: Scala
parent: Client libraries
url: https://github.com/influxdata/influxdb-client-java/tree/master/client-scala
weight: 201
---

View File

@ -11,7 +11,7 @@ menu:
v2_0_ref: v2_0_ref:
name: columns name: columns
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements, InfluxQL  SHOW MEASUREMENTS - https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements, InfluxQL  SHOW MEASUREMENTS
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys, InfluxQL  SHOW FIELD KEYS - https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys, InfluxQL  SHOW FIELD KEYS

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: cumulativeSum name: cumulativeSum
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- /v2.0/query-data/flux/cumulativesum/ - /v2.0/query-data/flux/cumulativesum/
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#cumulative-sum, InfluxQL CUMULATIVE_SUM() - https://docs.influxdata.com/influxdb/latest/query_language/functions/#cumulative-sum, InfluxQL CUMULATIVE_SUM()

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: drop name: drop
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
--- ---
The `drop()` function removes specified columns from a table. The `drop()` function removes specified columns from a table.

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: duplicate name: duplicate
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
--- ---
The `duplicate()` function duplicates a specified column in a table. The `duplicate()` function duplicates a specified column in a table.

View File

@ -7,7 +7,7 @@ menu:
v2_0_ref: v2_0_ref:
name: elapsed name: elapsed
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
--- ---
The `elapsed()` function returns the time between subsequent records. The `elapsed()` function returns the time between subsequent records.

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: fill name: fill
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- /v2.0/query-data/flux/fill/ - /v2.0/query-data/flux/fill/
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#group-by-time-intervals-and-fill, InfluxQL  FILL - https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#group-by-time-intervals-and-fill, InfluxQL  FILL

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: filter name: filter
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
v2.0/tags: [exists] v2.0/tags: [exists]
related: related:
- /v2.0/query-data/flux/query-fields/ - /v2.0/query-data/flux/query-fields/

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: group name: group
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- /v2.0/query-data/flux/group-data/ - /v2.0/query-data/flux/group-data/
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause, InfluxQL  GROUP BY - https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause, InfluxQL  GROUP BY

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: histogram name: histogram
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- /v2.0/query-data/flux/histograms/ - /v2.0/query-data/flux/histograms/
--- ---

View File

@ -10,7 +10,7 @@ menu:
v2_0_ref: v2_0_ref:
name: hourSelection name: hourSelection
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
--- ---
The `hourSelection()` function retains all rows with time values in a specified hour range. The `hourSelection()` function retains all rows with time values in a specified hour range.

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: join name: join
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- /v2.0/query-data/flux/join/ - /v2.0/query-data/flux/join/
- /v2.0/reference/flux/stdlib/built-in/transformations/union/ - /v2.0/reference/flux/stdlib/built-in/transformations/union/

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: keep name: keep
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
--- ---
The `keep()` function returns a table containing only the specified columns, ignoring all others. The `keep()` function returns a table containing only the specified columns, ignoring all others.

View File

@ -11,7 +11,7 @@ menu:
v2_0_ref: v2_0_ref:
name: keys name: keys
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements, InfluxQL SHOW MEASUREMENTS - https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements, InfluxQL SHOW MEASUREMENTS
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys, InfluxQL SHOW FIELD KEYS - https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys, InfluxQL SHOW FIELD KEYS

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: keyValues name: keyValues
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements, InfluxQL  SHOW MEASUREMENTS - https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements, InfluxQL  SHOW MEASUREMENTS
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys, InfluxQL  SHOW FIELD KEYS - https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys, InfluxQL  SHOW FIELD KEYS

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: limit name: limit
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- /v2.0/query-data/flux/sort-limit/ - /v2.0/query-data/flux/sort-limit/
- /v2.0/reference/flux/stdlib/built-in/transformations/tail/ - /v2.0/reference/flux/stdlib/built-in/transformations/tail/

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: map name: map
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
v2.0/tags: [exists] v2.0/tags: [exists]
related: related:
- /v2.0/query-data/flux/conditional-logic/ - /v2.0/query-data/flux/conditional-logic/

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: pivot name: pivot
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
--- ---
The `pivot()` function collects values stored vertically (column-wise) in a table The `pivot()` function collects values stored vertically (column-wise) in a table

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: range name: range
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-where-clause, InfluxQL WHERE - https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-where-clause, InfluxQL WHERE
--- ---

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: rename name: rename
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
--- ---
The `rename()` function renames specified columns in a table. The `rename()` function renames specified columns in a table.

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: set name: set
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
--- ---
The `set()` function assigns a static value to each record in the input table. The `set()` function assigns a static value to each record in the input table.

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: sort name: sort
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- /v2.0/query-data/flux/sort-limit/ - /v2.0/query-data/flux/sort-limit/
--- ---

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: stateCount name: stateCount
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- /v2.0/query-data/flux/monitor-states/ - /v2.0/query-data/flux/monitor-states/
--- ---

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: stateDuration name: stateDuration
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- /v2.0/query-data/flux/monitor-states/ - /v2.0/query-data/flux/monitor-states/
--- ---

View File

@ -20,7 +20,27 @@ related:
Use stream and table functions to extract a table from a stream of tables and access its Use stream and table functions to extract a table from a stream of tables and access its
columns and records. columns and records.
##### Example stream and table functions {{< children type="functions" >}}
### Example stream and table functions
##### Recommended usage
```js
data = from(bucket:"example-bucket")
|> range(start: -5m)
|> filter(fn:(r) => r._measurement == "cpu")
// Extract the "_value" column from the table
data
|> findColumn(fn: (key) => key._field == "usage_idle", column: "_value")
// Extract the first record from the table
data
|> findRecord(fn: (key) => key._field == "usage_idle", idx: 0)
```
##### Alternate usage
```js ```js
data = from(bucket:"example-bucket") data = from(bucket:"example-bucket")
|> range(start: -5m) |> range(start: -5m)
@ -35,5 +55,3 @@ values = t |> getColumn(column: "_value")
// Extract the first record from the table // Extract the first record from the table
r0 = t |> getRecord(idx: 0) r0 = t |> getRecord(idx: 0)
``` ```
{{< children type="functions" >}}

View File

@ -0,0 +1,54 @@
---
title: findColumn() function
description: >
The `findColumn()` function returns an array of values in a specified column from the
first table in a stream of tables where group key values match the specified predicate.
menu:
v2_0_ref:
name: findColumn
parent: Stream & table
weight: 501
related:
- /v2.0/query-data/flux/scalar-values/
---
The `findColumn()` function returns an array of values in a specified column from the
first table in a stream of tables where the group key values match the specified predicate.
The function returns an empty array if no table is found or if the column label
is not present in the set of columns.
_**Function type:** Stream and table_
```js
findColumn(
fn: (key) => key._field == "fieldName")
column: "_value"
)
```
## Parameters
### fn
A predicate function for matching keys in a table's group key.
Expects a `key` argument that represents a group key in the input stream.
_**Data type:** Function_
### column
Name of the column to extract.
_**Data type:** String_
## Example
```js
vs = from(bucket:"example-bucket")
|> range(start: -5m)
|> filter(fn:(r) => r._measurement == "cpu")
|> findColumn(
fn: (key) => key._field == "usage_idle",
column: "_value"
)
// Use column values
x = vs[0] + vs[1]
```

View File

@ -0,0 +1,54 @@
---
title: findRecord() function
description: >
The `findRecord()` function returns a record at a specified index from the first
table in a stream of tables where the group key values match the specified predicate.
menu:
v2_0_ref:
name: findRecord
parent: Stream & table
weight: 501
related:
- /v2.0/query-data/flux/scalar-values/
---
The `findRecord()` function returns a record at a specified index from the first
table in a stream of tables where the group key values match the specified predicate.
The function returns an empty object if no table is found or if the index is out of bounds.
_**Function type:** Stream and table_
```js
findRecord(
fn: (key) => key._field == "fieldName",
idx: 0
)
```
## Parameters
### fn
A predicate function for matching keys in a table's group key.
Expects a `key` argument that represents a group key in the input stream.
_**Data type:** Function_
### idx
Index of the record to extract.
_**Data type:** Integer_
## Example
```js
r0 = from(bucket:"example-bucket")
|> range(start: -5m)
|> filter(fn:(r) => r._measurement == "cpu")
|> tableFind()
|> findRecord(
fn: (key) => key._field == "usage_idle",
idx: 0
)
// Use record values
x = r0._field + "--" + r0._measurement
```

View File

@ -33,7 +33,7 @@ to extract a single table from a stream of tables.
## Parameters ## Parameters
### column ### column
The name of the column to extract. Name of the column to extract.
_**Data type:** String_ _**Data type:** String_

View File

@ -33,7 +33,7 @@ to extract a single table from a stream of tables.
## Parameters ## Parameters
### idx ### idx
The index of the record to extract. Index of the record to extract.
_**Data type:** Integer_ _**Data type:** Integer_

View File

@ -34,7 +34,7 @@ To learn why, see [Match parameter names](/v2.0/reference/flux/language/data-mod
A predicate function for matching keys in a table's group key. A predicate function for matching keys in a table's group key.
`tableFind` returns the first table that resolves as `true`. `tableFind` returns the first table that resolves as `true`.
It expects a `key` argument which represents a group key in the input stream. Expects a `key` argument that represents a group key in the input stream.
_**Data type:** Function_ _**Data type:** Function_

View File

@ -7,7 +7,7 @@ menu:
v2_0_ref: v2_0_ref:
name: tail name: tail
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- /v2.0/reference/flux/functions/built-in/transformations/limit/ - /v2.0/reference/flux/functions/built-in/transformations/limit/
--- ---

View File

@ -9,7 +9,7 @@ menu:
v2_0_ref: v2_0_ref:
name: timeShift name: timeShift
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
--- ---
The `timeShift()` function adds a fixed duration to time columns. The `timeShift()` function adds a fixed duration to time columns.

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: truncateTimeColumn name: truncateTimeColumn
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- /v2.0/reference/flux/stdlib/date/truncate/ - /v2.0/reference/flux/stdlib/date/truncate/
--- ---

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: union name: union
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- /v2.0/reference/flux/stdlib/built-in/transformations/join/ - /v2.0/reference/flux/stdlib/built-in/transformations/join/
--- ---

View File

@ -8,7 +8,7 @@ menu:
v2_0_ref: v2_0_ref:
name: window name: window
parent: built-in-transformations parent: built-in-transformations
weight: 401 weight: 402
related: related:
- /v2.0/query-data/flux/window-aggregate/ - /v2.0/query-data/flux/window-aggregate/
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow/ - /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow/

View File

@ -0,0 +1,68 @@
---
title: experimental.chain() function
description: >
The `experimental.chain()` function runs two queries in a single Flux script
sequentially and outputs the results of the second query.
menu:
v2_0_ref:
name: experimental.chain
parent: Experimental
weight: 302
---
The `experimental.chain()` function runs two queries in a single Flux script
sequentially and outputs the results of the second query.
Flux typically executes multiple queries in a single script in parallel.
Running the queries sequentially ensures any dependencies the second query has on
the results of the first query are met.
##### Applicable use cases
- Writing to a bucket and querying the written data in a single Flux script or
[InfluxDB task](/v2.0/process-data/get-started/).
- Execute queries sequentially in testing scenarios.
_**Function type:** Miscellaneous_
```js
import "experimental"
experimental.chain(
first: query1,
second: query2
)
```
## Parameters
### first
The first query to execute.
_**Data type:** Stream of tables_
### second
The second query to execute.
_**Data type:** Stream of tables_
## Examples
### Write to a bucket and query the written data
```js
import "experimental"
downsampled_max = from(bucket: "example-bucket-1")
|> range(start: -1d)
|> filter(fn: (r) => r._measurement == "example-measurement")
|> aggregateWindow(every: 1h, fn: max)
|> to(bucket: "downsample-1h-max", org: "example-org")
average_max = from(bucket: "downsample-1h-max")
|> range(start: -1d)
|> filter(fn: (r) => r.measurement == "example-measurement")
|> mean()
experimental.chain(
first: downsampled_max,
second: average_max
)
```

View File

@ -0,0 +1,67 @@
---
title: v1.fieldKeys() function
description: The `v1.fieldKeys()` function returns field keys in a bucket.
menu:
v2_0_ref:
name: v1.fieldKeys
parent: InfluxDB v1
weight: 301
v2.0/tags: [fields]
related:
- /v2.0/query-data/flux/explore-schema/
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-field-keys, SHOW FIELD KEYS in InfluxQL
---
The `v1.fieldKeys()` function returns field keys 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 timestamps.
_**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](/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues/)_

View File

@ -36,6 +36,8 @@ from(bucket:"example-bucket")
## Function definition ## Function definition
```js ```js
package v1
fieldsAsCols = (tables=<-) => fieldsAsCols = (tables=<-) =>
tables tables
|> pivot( |> pivot(

View File

@ -0,0 +1,69 @@
---
title: v1.measurementFieldKeys() function
description: The `v1.measurementFieldKeys()` function returns a list of fields in a measurement.
menu:
v2_0_ref:
name: v1.measurementFieldKeys
parent: InfluxDB v1
weight: 301
v2.0/tags: [fields]
related:
- /v2.0/query-data/flux/explore-schema/
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-field-keys, SHOW FIELD KEYS in InfluxQL
---
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
The bucket to list field keys from.
_**Data type:** String_
### measurement
The measurement to list field keys from.
_**Data type:** String_
### 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 timestamps.
_**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](/v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys/)_

View File

@ -10,6 +10,7 @@ menu:
weight: 301 weight: 301
v2.0/tags: [measurements] v2.0/tags: [measurements]
related: related:
- /v2.0/query-data/flux/explore-schema/
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-measurements, SHOW MEASUREMENTS in InfluxQL - https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-measurements, SHOW MEASUREMENTS in InfluxQL
--- ---
@ -31,9 +32,11 @@ _**Data type:** String_
## Function definition ## Function definition
```js ```js
package v1
measurements = (bucket) => measurements = (bucket) =>
tagValues(bucket: bucket, tag: "_measurement") tagValues(bucket: bucket, tag: "_measurement")
``` ```
_**Used functions:** _**Used functions:**
[tagValues()](/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues)_ [v1.tagValues()](/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues)_

View File

@ -10,6 +10,7 @@ menu:
weight: 301 weight: 301
v2.0/tags: [tags] v2.0/tags: [tags]
related: related:
- /v2.0/query-data/flux/explore-schema/
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-keys, SHOW TAG KEYS in InfluxQL - https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-keys, SHOW TAG KEYS in InfluxQL
--- ---
@ -39,11 +40,14 @@ _**Data type:** String_
## Function definition ## Function definition
```js ```js
package v1
measurementTagKeys = (bucket, measurement) => measurementTagKeys = (bucket, measurement) =>
tagKeys( tagKeys(
bucket: bucket, bucket: bucket,
predicate: (r) => r._measurement == measurement) predicate: (r) => r._measurement == measurement
)
``` ```
_**Used functions:** _**Used functions:**
[tagKeys()](/v2.0/reference/flux/stdlib/influxdb-v1/tagkeys)_ [v1.tagKeys()](/v2.0/reference/flux/stdlib/influxdb-v1/tagkeys)_

View File

@ -10,6 +10,7 @@ menu:
weight: 301 weight: 301
v2.0/tags: [tags] v2.0/tags: [tags]
related: related:
- /v2.0/query-data/flux/explore-schema/
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-values, SHOW TAG VALUES in InfluxQL - https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-values, SHOW TAG VALUES in InfluxQL
--- ---
@ -48,6 +49,8 @@ _**Data type:** String_
## Function definition ## Function definition
```js ```js
package v1
measurementTagValues = (bucket, measurement, tag) => measurementTagValues = (bucket, measurement, tag) =>
tagValues( tagValues(
bucket: bucket, bucket: bucket,
@ -57,4 +60,4 @@ measurementTagValues = (bucket, measurement, tag) =>
``` ```
_**Used functions:** _**Used functions:**
[tagValues()](/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues)_ [v1.tagValues()](/v2.0/reference/flux/stdlib/influxdb-v1/tagvalues)_

View File

@ -10,6 +10,7 @@ menu:
weight: 301 weight: 301
v2.0/tags: [tags] v2.0/tags: [tags]
related: related:
- /v2.0/query-data/flux/explore-schema/
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-keys, SHOW TAG KEYS in InfluxQL - https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-keys, SHOW TAG KEYS in InfluxQL
--- ---
@ -40,7 +41,7 @@ _Defaults to `(r) => true`._
_**Data type:** Function_ _**Data type:** Function_
### start ### start
Specifies the oldest time to be included in the results. The oldest time to include in results.
_Defaults to `-30d`._ _Defaults to `-30d`._
Relative start times are defined using negative durations. Relative start times are defined using negative durations.
@ -59,6 +60,8 @@ v1.tagKeys(bucket: "my-bucket")
## Function definition ## Function definition
```js ```js
package v1
tagKeys = (bucket, predicate=(r) => true, start=-30d) => tagKeys = (bucket, predicate=(r) => true, start=-30d) =>
from(bucket: bucket) from(bucket: bucket)
|> range(start: start) |> range(start: start)

View File

@ -10,6 +10,7 @@ menu:
weight: 301 weight: 301
v2.0/tags: [tags] v2.0/tags: [tags]
related: related:
- /v2.0/query-data/flux/explore-schema/
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-values, SHOW TAG VALUES in InfluxQL - https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration#show-tag-values, SHOW TAG VALUES in InfluxQL
--- ---
@ -46,7 +47,7 @@ _Defaults to `(r) => true`._
_**Data type:** Function_ _**Data type:** Function_
### start ### start
Specifies the oldest time to be included in the results. The oldest time to include in results.
_Defaults to `-30d`._ _Defaults to `-30d`._
Relative start times are defined using negative durations. Relative start times are defined using negative durations.
@ -59,7 +60,7 @@ _**Data type:** Duration_
```js ```js
import "influxdata/influxdb/v1" import "influxdata/influxdb/v1"
v1.tagKeys( v1.tagValues(
bucket: "my-bucket", bucket: "my-bucket",
tag: "host", tag: "host",
) )
@ -67,6 +68,8 @@ v1.tagKeys(
## Function definition ## Function definition
```js ```js
package v1
tagValues = (bucket, tag, predicate=(r) => true, start=-30d) => tagValues = (bucket, tag, predicate=(r) => true, start=-30d) =>
from(bucket: bucket) from(bucket: bucket)
|> range(start: start) |> range(start: start)

View File

@ -18,7 +18,7 @@ related:
--- ---
SQL Flux functions provide tools for working with data in SQL databases such as SQL Flux functions provide tools for working with data in SQL databases such as
MySQL, PostgreSQL, and SQLite. MySQL, PostgreSQL, Snowflake, and SQLite.
Import the `sql` package: Import the `sql` package:
```js ```js

View File

@ -37,6 +37,7 @@ The following drivers are available:
- mysql - mysql
- postgres - postgres
- snowflake
- sqlite3 _Does not work with InfluxDB OSS or InfluxDB Cloud. More information [below](#query-an-sqlite-database)._ - sqlite3 _Does not work with InfluxDB OSS or InfluxDB Cloud. More information [below](#query-an-sqlite-database)._
### dataSourceName ### dataSourceName
@ -53,6 +54,11 @@ postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full
# MySQL Driver DSN # MySQL Driver DSN
username:password@tcp(localhost:3306)/dbname?param=value username:password@tcp(localhost:3306)/dbname?param=value
# Snowflake Driver DSNs
username[:password]@accountname/dbname/schemaname?param1=value1&paramN=valueN
username[:password]@accountname/dbname?param1=value1&paramN=valueN
username[:password]@hostname:port/dbname/schemaname?account=<your_account>&param1=value1&paramN=valueN
# SQLite Driver DSN # SQLite Driver DSN
file:/path/to/test.db?cache=shared&mode=ro file:/path/to/test.db?cache=shared&mode=ro
``` ```
@ -80,7 +86,7 @@ password = secrets.get(key: "MYSQL_PASS")
sql.from( sql.from(
driverName: "mysql", driverName: "mysql",
dataSourceName: "${username}:${password}@tcp(localhost:3306)/db", dataSourceName: "${username}:${password}@tcp(localhost:3306)/db",
query:"SELECT * FROM ExampleTable" query:"SELECT * FROM example_table"
) )
``` ```
@ -95,7 +101,23 @@ password = secrets.get(key: "POSTGRES_PASS")
sql.from( sql.from(
driverName: "postgres", driverName: "postgres",
dataSourceName: "postgresql://${username}:${password}@localhost", dataSourceName: "postgresql://${username}:${password}@localhost",
query:"SELECT * FROM ExampleTable" query:"SELECT * FROM example_table"
)
```
### Query a Snowflake database
```js
import "sql"
import "influxdata/influxdb/secrets"
username = secrets.get(key: "SNOWFLAKE_USER")
password = secrets.get(key: "SNOWFLAKE_PASS")
account = secrets.get(key: "SNOWFLAKE_ACCT")
sql.from(
driverName: "snowflake",
dataSourceName: "${username}:${password}@${account}/db/exampleschema?warehouse=wh",
query: "SELECT * FROM example_table"
) )
``` ```
@ -114,6 +136,6 @@ import "sql"
sql.from( sql.from(
driverName: "sqlite3", driverName: "sqlite3",
dataSourceName: "file:/path/to/test.db?cache=shared&mode=ro", dataSourceName: "file:/path/to/test.db?cache=shared&mode=ro",
query:"SELECT * FROM ExampleTable" query: "SELECT * FROM example_table"
) )
``` ```

View File

@ -20,7 +20,7 @@ import "sql"
sql.to( sql.to(
driverName: "mysql", driverName: "mysql",
dataSourceName: "username:password@tcp(localhost:3306)/dbname?param=value", dataSourceName: "username:password@tcp(localhost:3306)/dbname?param=value",
table: "ExampleTable", table: "example_table",
batchSize: 10000 batchSize: 10000
) )
``` ```
@ -36,6 +36,7 @@ The following drivers are available:
- mysql - mysql
- postgres - postgres
- snowflake
- sqlite3 _Does not work with InfluxDB OSS or InfluxDB Cloud. More information [below](#write-data-to-an-sqlite-database)._ - sqlite3 _Does not work with InfluxDB OSS or InfluxDB Cloud. More information [below](#write-data-to-an-sqlite-database)._
### dataSourceName ### dataSourceName
@ -52,6 +53,11 @@ postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full
# MySQL Driver DSN # MySQL Driver DSN
username:password@tcp(localhost:3306)/dbname?param=value username:password@tcp(localhost:3306)/dbname?param=value
# Snowflake Driver DSNs
username[:password]@accountname/dbname/schemaname?param1=value1&paramN=valueN
username[:password]@accountname/dbname?param1=value1&paramN=valueN
username[:password]@hostname:port/dbname/schemaname?account=<your_account>&param1=value1&paramN=valueN
# SQLite Driver DSN # SQLite Driver DSN
file:/path/to/test.db?cache=shared&mode=rw file:/path/to/test.db?cache=shared&mode=rw
``` ```
@ -89,7 +95,7 @@ password = secrets.get(key: "MYSQL_PASS")
sql.to( sql.to(
driverName: "mysql", driverName: "mysql",
dataSourceName: "${username}:${password}@tcp(localhost:3306)/db", dataSourceName: "${username}:${password}@tcp(localhost:3306)/db",
table: "ExampleTable" table: "example_table"
) )
``` ```
@ -104,7 +110,23 @@ password = secrets.get(key: "POSTGRES_PASS")
sql.to( sql.to(
driverName: "postgres", driverName: "postgres",
dataSourceName: "postgresql://${username}:${password}@localhost", dataSourceName: "postgresql://${username}:${password}@localhost",
table: "ExampleTable" table: "example_table"
)
```
### Write data to a Snowflake database
```js
import "sql"
import "influxdata/influxdb/secrets"
username = secrets.get(key: "SNOWFLAKE_USER")
password = secrets.get(key: "SNOWFLAKE_PASS")
account = secrets.get(key: "SNOWFLAKE_ACCT")
sql.to(
driverName: "snowflake",
dataSourceName: "${username}:${password}@${account}/db/exampleschema?warehouse=wh",
table: "example_table"
) )
``` ```
@ -123,6 +145,6 @@ import "sql"
sql.to( sql.to(
driverName: "sqlite3", driverName: "sqlite3",
dataSourceName: "file:/path/to/test.db?cache=shared&mode=rw", dataSourceName: "file:/path/to/test.db?cache=shared&mode=rw",
table: "ExampleTable" table: "example_table"
) )
``` ```

View File

@ -16,6 +16,137 @@ Though newer versions of Flux may be available, they will not be included with
InfluxDB until the next InfluxDB v2.0 release._ InfluxDB until the next InfluxDB v2.0 release._
{{% /note %}} {{% /note %}}
## v0.68.0 [2020-05-28]
This version of Flux introduces an updated type inference system that improves
performance, error messaging, and usability of the
[Flux Language Server Protocol (LSP)](https://github.com/influxdata/flux-lsp).
## Breaking Changes
- Change signature of `group()` function.
## Features
- Add [`fieldKeys()`](/v2.0/reference/flux/stdlib/influxdb-v1/fieldkeys/) and
[`measurementFieldKeys()`](/v2.0/reference/flux/stdlib/influxdb-v1/measurementfieldkeys/)
to v1 package.
- Add a context to `plantest.RuleTestCase`.
- Add Snowflake support to SQL package.
- Add [`experimental.chain()`](/v2.0/reference/flux/stdlib/experimental/chain/) function.
- Add semantic nodes for bad statement and bad expression.
- Add [`findColumn()`](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/findcolumn/)
and [`findRecord()`](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/findrecord/) functions.
- Return `false` if `contains()` is called with an empty set.
- Various performance optimizations.
- Add a dynamically linked Valgrind test.
- Add location information to type error messages.
- Add all Linux cross-compilation tools to release Docker image.
- Support remote `buckets()` and `v1.databases()` calls.
- Add support for static linking.
- Add `influxdb` source.
- Add support for `pkg-config`.
- Transform semantic nodes back to AST nodes.
- Handle multi-file packages.
- Make `Eval()` and `EvalAST()` use libflux for parsing and analysis.
- Add `lookuptype` function for stdlib builtins.
## Bug Fixes
- Re-enable Clippy linter rule match single binding.
- Fix bug in object equal method.
- Add builtin formatting.
- Implement `TimeBounds` for `influxdb.fromRemote`.
- Inject the URL validator into `NewDefaultClient`.
- Fix race condition in the `filter()` function.
- Validate HTTP redirects against private IPs.
- Hide DNS information in HTTP.
- Fix concurrent map write in `filter()` transformation.
- Copy all fields of `WindowProcedureSpec` in `Copy()`.
- Run `go generate` on libflux when `go generate` is run on stdlib.
- Fix panic when `map()` overwrites group column.
- Support execution contexts in the REPL.
- Apply substitution fully when compiling lambda.
- Planner rewrite rules take a context.
- Fix panics when functions operate on null values.
- Fix logic for merging packages with no package clause.
- Compute function's return type after substitution.
- Resolve member expressions.
- Improve error message descriptions.
- Check types of parts when evaluating `StringExpression`.
- Bind appropriate interpreter when evaluating functions.
- Tweak Rust JSON serialization and add tests.
- Pivot sends update watermark and processing time exactly once.
- Calculate diff's watermark using both predecessors.
- Add length check to avoid allocs checking for JSON `null`.
- Make compilers robust to `null` keyword in `extern` field.
- Address issues in `RemoveTrivialFilterRule`.
- Bind appropriate interpreter when evaluating functions.
- Convert `HashMap` in semantic package to `BTreeMap`.
- Use static linking when creating the Valgrind test.
- Update `flatbuffers` dependency.
- Fix JSON serialization of Rust AST.
- Remove unused environment variables.
- Make `merge_packages` allow no package clauses.
- Do not call `CheckKind` when evaluating logical expressions.
- Force the Go libflux wrapper to rebuild using `go generate`.
- Adjust `test-bench` config for Circle CI.
- Fix Valgrind test code.
- Let Rust parser parse with file name.
- Remove Algorithm-W to-do list.
- `JoinStr` returns a string, not an empty record.
- Only add visible properties to output of `map()`.
- Serialize the correct sign duration literal.
- Remove code in semantic package that depends on Rust/Cgo code.
- Remove `component` field from API.
- Remove unused notification rule fields from Slack and PagerDuty APIs.
- Array builders accept array types as input.
- Enable `map()` tests with null values.
- Remove tests for marshalling semantic graph.
- Run `make generate` to generate stdlib.
- Fix type error in benchmark test.
- Update `TableObject` test.
- Do not call `LocalRange` on nil scope.
- Type assertion error in `length()` tests.
- Update type inference test case with test for `union()`.
- Make non-test CI steps pass.
- Fix semantic check for option reassignment.
- Type inference tests for binary comparison operators.
- Fix typo in builtins.
- Update `holtWinters()` to make `seasonality` optional.
- Fix type errors in tests.
- Remove default value from notify data.
- Allow options to be set in scope.
- Replace `ScopeComparer` with `ScopeTransformer`.
- Use `LocalRange` in compile tests.
- Add missing parameter to type of `to()`.
- Get `TableObject` test case to compile.
- Fix typo in test case.
- Update `TableObjects` to type `Array`.
- Use array type method correctly.
- Update schema mutators.
- Return proper types for type conversion functions.
- Enable complete package to compile and pass tests.
- Make stdlib compile.
- Expect monotypes for function values.
- Require successful lookup of stdlib builtins or panic.
- Optimize lookup function using hashmap.
- Include function type when deserializing function expressions.
---
## v0.67.0 [2020-04-28]
### Features
- Planner Pattern interface supplies a set of ProcedureKind as root.
- Initial prototype of a table-based Flux.
- Evaluate and store "now" in execution dependencies for `tableFind()` to use.
- Static analysis tool for listing entry points to Flux.
- Pass context to rewrite rules in the planner.
### Bug fixes
- Pivot sends update watermark and processing time exactly once.
- `system.time()` checks context for override.
- Add bounds to alignTime tests.
---
## v0.66.1 [2020-04-14] ## v0.66.1 [2020-04-14]
### Bug fixes ### Bug fixes
@ -177,7 +308,7 @@ InfluxDB until the next InfluxDB v2.0 release._
## v0.59.0 [2020-01-14] ## v0.59.0 [2020-01-14]
### Features ### Features
- Add Go/Rust API for getting semantic graph.. - Add Go/Rust API for getting semantic graph.
- Optimize `limit()` transformation. - Optimize `limit()` transformation.
- Optimize `group()` transformation. - Optimize `group()` transformation.
@ -235,7 +366,7 @@ InfluxDB until the next InfluxDB v2.0 release._
- Update `experimental.set` builtin type. - Update `experimental.set` builtin type.
- Update the type of `influxdb.to` to be a passthrough. - Update the type of `influxdb.to` to be a passthrough.
- Update `fill` builtin type. - Update `fill` builtin type.
- Remove redundant clones found by a new version of clippy. - Remove redundant clones found by a new version of Clippy.
- Fix durations in Rust semantic graph. - Fix durations in Rust semantic graph.
- Removes unnecessary rc clone in semantic serializer. - Removes unnecessary rc clone in semantic serializer.
- Do not stall forever in flux-config when an error happens with verbose. - Do not stall forever in flux-config when an error happens with verbose.
@ -250,7 +381,7 @@ InfluxDB until the next InfluxDB v2.0 release._
## v0.57.0 [2019-12-10] ## v0.57.0 [2019-12-10]
### Features ### Features
- Categorize more flux errors with codes. - Categorize more Flux errors with codes.
- Teach flux-config how to download the sources when using vendor. - Teach flux-config how to download the sources when using vendor.
- Opentracing in query execution runtime. - Opentracing in query execution runtime.
- Reduce memory allocations for operations in values. - Reduce memory allocations for operations in values.
@ -276,7 +407,7 @@ InfluxDB until the next InfluxDB v2.0 release._
### Bug fixes ### Bug fixes
- Properly use a fake version with `flux-config` when no version is present. - Properly use a fake version with `flux-config` when no version is present.
- Address clippy lints. - Address Clippy lints.
- Add bytes monotype to Rust semantic module. - Add bytes monotype to Rust semantic module.
- Allow underscores (`_`) in type expressions. - Allow underscores (`_`) in type expressions.
@ -392,7 +523,7 @@ InfluxDB until the next InfluxDB v2.0 release._
- Update libflux parser to match the Go parser. - Update libflux parser to match the Go parser.
- Allow data collected by `prometheus.scrape()` to be used by `histogramQuantile()`. - Allow data collected by `prometheus.scrape()` to be used by `histogramQuantile()`.
- Remove mock allocator. - Remove mock allocator.
- Validate url for `sql.from()`, `sql.to()`, and `socket.from()`. - Validate URL for `sql.from()`, `sql.to()`, and `socket.from()`.
--- ---

View File

@ -13,17 +13,21 @@ cloud:
short_name: AWS short_name: AWS
regions: regions:
- name: US West (Oregon) - name: US West (Oregon)
location: Oregon, USA
url: https://us-west-2-1.aws.cloud2.influxdata.com url: https://us-west-2-1.aws.cloud2.influxdata.com
- name: EU Frankfurt - name: EU Frankfurt
location: Frankfurt, Germany
url: https://eu-central-1-1.aws.cloud2.influxdata.com url: https://eu-central-1-1.aws.cloud2.influxdata.com
- name: Google Cloud Platform - name: Google Cloud Platform
short_name: GCP short_name: GCP
regions: regions:
- name: US Central (Iowa) - name: US Central (Iowa)
location: Iowa, USA
url: https://us-central1-1.gcp.cloud2.influxdata.com url: https://us-central1-1.gcp.cloud2.influxdata.com
- name: Microsoft Azure - name: Microsoft Azure
short_name: Azure short_name: Azure
regions: regions:
- name: West Europe - name: West Europe
location: Amsterdam, Netherlands
url: https://westeurope-1.azure.cloud2.influxdata.com url: https://westeurope-1.azure.cloud2.influxdata.com
status: beta status: beta

View File

@ -13,11 +13,13 @@
<table> <table>
<thead> <thead>
<th align="left">Region</th> <th align="left">Region</th>
<th align="left">Location</th>
<th align="left">URL</th> <th align="left">URL</th>
</thead> </thead>
{{ range .regions }} {{ range .regions }}
<tr> <tr>
<td {{ if .status }}class="{{ .status }}"{{ end }}>{{ .name }}</td> <td {{ if .status }}class="{{ .status }}"{{ end }}>{{ .name }}</td>
<td>{{ .location }}</td>
<td><a href="{{ .url }}">{{ .url }}</a></td> <td><a href="{{ .url }}">{{ .url }}</a></td>
</tr> </tr>
{{ end }} {{ end }}