docs-v2/content/v2.0/reference/flux/stdlib/built-in/inputs/from.md

2.1 KiB

title description aliases menu weight related
from() function The `from()` function retrieves data from an InfluxDB data source.
/v2.0/reference/flux/functions/inputs/from
/v2.0/reference/flux/functions/built-in/inputs/from/
v2_0_ref
name parent
from built-in-inputs
401
https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#from-clause, InfluxQL - FROM

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.

Function type: Input
Output data type: Object

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

// OR

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

Parameters

{{% note %}} host, org or orgID, and token parameters are only required when querying data from a different organization or a remote InfluxDB instance. {{% /note %}}

bucket

Name of the bucket to query.

Data type: String

bucketID

String-encoded bucket ID to query.

Data type: String

host

URL of the InfluxDB instance to query. See InfluxDB URLs.

Data type: String

org

Organization name.

Data type: String

orgID

String-encoded organization ID to query.

Data type: String

token

InfluxDB authentication token.

Data type: String

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
)