Documentation

from() function

Flux 0.7.0+

The from() function retrieves data from an InfluxDB data source. It returns a stream of tables from the specified bucket. Each unique series is contained within its own table. Each record in the table represents a single point in the series.

from(
  bucket: "example-bucket",
  host: "https://example.com",
  org: "example-org",
  token: "MySuP3rSecr3Tt0k3n"
)

// OR

from(
  bucketID: "0261d8287f4d6000",
  host: "https://example.com",
  orgID: "867f3fcf1846f11f",
  token: "MySuP3rSecr3Tt0k3n"
)

from() does not require a package import

from() is part of the influxdata/influxdb package, but is included with the universe package by default and does not require an import statement or package namespace.

Query remote InfluxDB data sources

Use from() to retrieve data from remote InfluxDB OSS 1.7+, InfluxDB Enterprise 1.9+, and InfluxDB Cloud. To query remote InfluxDB sources, include the host, token, and org (or orgID) parameters.

Parameters

bucket

Name of the bucket to query.

InfluxDB 1.x or Enterprise: Provide an empty string ("").

bucketID

String-encoded bucket ID to query.

InfluxDB 1.x or Enterprise: Provide an empty string ("").

host

URL of the InfluxDB instance to query. See InfluxDB URLs or InfluxDB Cloud regions.

org

Organization name.

InfluxDB 1.x or Enterprise: Provide an empty string ("").

orgID

String-encoded organization ID to query.

InfluxDB 1.x or Enterprise: Provide an empty string ("").

token

InfluxDB API token.

InfluxDB 1.x or Enterprise: If authentication is disabled, provide an empty string (""). If authentication is enabled, provide your InfluxDB username and password using the <username>:<password> syntax.

Examples

Query using the bucket name

from(bucket: "example-bucket")

Query using the bucket ID

from(bucketID: "0261d8287f4d6000")

Query a remote InfluxDB Cloud instance

import "influxdata/influxdb/secrets"

token = secrets.get(key: "INFLUXDB_CLOUD_TOKEN")

from(
  bucket: "example-bucket",
  host: "https://cloud2.influxdata.com",
  org: "example-org",
  token: token
)

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.