influxdata / flux

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.
https://influxdata.com
MIT License
767 stars 153 forks source link

v1.json with JSON string as input still requires access to the filesystem #5343

Closed sanderson closed 1 year ago

sanderson commented 1 year ago

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.

github-actions[bot] commented 1 year ago

This issue has had no recent activity and will be closed soon.