Flux is a lightweight scripting language for querying databases (like InfluxDB) and working with data. It's part of InfluxDB 1.7 and 2.0, but can be run independently of those.
As an experiment, I tried querying InfluxDB using InfluxQL inside of Flux. It works until I try to use v1.json() and the string-encoded response body to create a stream of tables:
import "http/requests"
import "influxdata/influxdb/v1"
import "influxdata/influxdb/secrets"
token = secrets.get(key: "INFLUX_TOKEN")
query = "SELECT \"water_level\" FROM \"noaa\".\"autogen\".\"h2o_feet\" WHERE \"location\"='santa_monica' AND time >= '2019-08-18T00:00:00Z' AND time <= '2019-08-18T00:30:00Z'"
response = requests.get(
url: "http://localhost:8086/query",
params: [
"db": ["noaa"],
"rp": ["autogen"],
"q": [query],
],
headers: ["Authorization": "Token ${token}"]
)
v1.json(json: string(v: response.body))
If I run this in the InfluxDB Data Explorer, get the following error:
failed to initialize execute state: filesystem service uninitialized in dependencies
I know Flux does not have access to the filesystem inside of InfluxDB, but v1.json() shouldn't need access to the filesystem if the json parameter is used rather than the file parameter.
As an experiment, I tried querying InfluxDB using InfluxQL inside of Flux. It works until I try to use
v1.json()
and the string-encoded response body to create a stream of tables:If I run this in the InfluxDB Data Explorer, get the following error:
I know Flux does not have access to the filesystem inside of InfluxDB, but
v1.json()
shouldn't need access to the filesystem if thejson
parameter is used rather than thefile
parameter.