查询数据源
使用 Flux 查询以下数据源
InfluxDB
使用 from()
和 range
,通过 Flux 查询 InfluxDB 中的数据。
from(bucket: "example-bucket")
|> range(start: -1h)
SQL 数据库
使用 sql.from()
,通过 Flux 查询 SQL 数据库。
import "sql"
sql.from(
driverName: "postgres",
dataSourceName: "postgresql://user:password@localhost",
query:"SELECT * FROM TestTable",
)
CSV
使用 csv.from()
和 experimental csv.from()
,通过 Flux 查询 CSV 数据。查询 CSV 字符串、CSV 文件或来自 URL 的 CSV 数据。
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
使用 bigtable.from
,通过 Flux 查询 Google Cloud Bigtable。
import "experimental/bigtable"
bigtable.from(url: "http://example.com/metrics")
此页内容对您有帮助吗?
感谢您的反馈!