Query data sources
Query the following data sources with Flux:
InfluxDB
Use from()
and range
to query data from InfluxDB using Flux.
from(bucket: "example-bucket")
|> range(start: -1h)
SQL databases
Use sql.from()
to query SQL databases with Flux.
import "sql"
sql.from(
driverName: "postgres",
dataSourceName: "postgresql://user:password@localhost",
query:"SELECT * FROM TestTable",
)
CSV
Use csv.from()
and experimental csv.from()
to query CSV data with Flux. Query a CSV string, CSV file, or CSV data from a URL.
import "csv"
csvData =
"
#group,false,false,true,true,true,false,false
#datatype,string,long,string,string,string,long,double
#default,_result,,,,,,
,result,table,dataset,metric,sensorID,timestamp,value
,,0,air-sensors,humidity,TLM0100,1627049400000000000,34.79
,,0,air-sensors,humidity,TLM0100,1627049700000000000,34.65
,,1,air-sensors,humidity,TLM0200,1627049400000000000,35.64
,,1,air-sensors,humidity,TLM0200,1627049700000000000,35.67
"
csv.from(csv: csvData)
Google Cloud Bigtable
Use bigtable.from
to query Google Cloud Bigtable with Flux.
import "experimental/bigtable"
bigtable.from(url: "http://example.com/metrics")
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.