Documentation

from() function

from() queries 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.

Query remote InfluxDB data sources

Use from() to query 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.

from() does not require a package import

from() is part of the influxdata/influxdb package, but is part of the Flux prelude and does not require an import statement or package namespace.

Function type signature
(
    ?bucket: string,
    ?bucketID: string,
    ?host: string,
    ?org: string,
    ?orgID: string,
    ?token: string,
) => stream[{A with _value: B, _time: time, _measurement: string, _field: string}]
For more information, see Function type signatures.

Parameters

bucket

Name of the bucket to query. bucket and bucketID are mutually exclusive.

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

bucketID

String-encoded bucket ID to query. bucket and bucketID are mutually exclusive.

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

host

URL of the InfluxDB instance to query.

See InfluxDB Cloud regions or InfluxDB OSS URLs.

org

Organization name. org and orgID are mutually exclusive.

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

orgID

String-encoded organization ID to query. org and orgID are mutually exclusive.

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 InfluxDB using the bucket name

from(bucket: "example-bucket")

Query InfluxDB 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://us-west-2-1.aws.cloud2.influxdata.com",
    org: "example-org",
    token: token,
)

Was this page helpful?

Thank you for your feedback!


Linux Package Signing Key Rotation

All signed InfluxData Linux packages have been resigned with an updated key. If using Linux, you may need to update your package configuration to continue to download and verify InfluxData software packages.

For more information, see the Linux Package Signing Key Rotation blog post.

InfluxDB Cloud backed by InfluxDB IOx

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by IOx, this is the correct documentation.

If powered by TSM, see the TSM-based InfluxDB Cloud documentation.

InfluxDB Cloud backed by InfluxDB TSM

All InfluxDB Cloud organizations created on or after January 31, 2023 are backed by the new InfluxDB IOx storage engine which enables nearly unlimited series cardinality and SQL query support. Check the right column of your InfluxDB Cloud organization homepage to see which InfluxDB storage engine you’re using.

If powered by TSM, this is the correct documentation.

If powered by IOx, see the IOx-based InfluxDB Cloud documentation.

State of the InfluxDB Cloud (IOx) documentation

The new documentation for InfluxDB Cloud backed by InfluxDB IOx is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.