from() function
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
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"
)
Query remote InfluxDB data sources
Use from()
to retrieve data from remote InfluxDB 2.0 OSS and InfluxDB Cloud instances.
To query remote InfluxDB sources, include the host, token, and
org (or orgID) parameters.
from()
cannot retrieve data from remote InfluxDB OSS 1.x or InfluxDB Enterprise 1.x data sources
(including hosted, single-tenant InfluxDB Enterprise clusters).
Parameters
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
)
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.