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
769 stars 153 forks source link

error in csv.from(): csv.from() failed to read file: filesystem service is uninitialized #5507

Open songhaisheng98 opened 1 month ago

songhaisheng98 commented 1 month ago

load a csv file by csv.from failed

Through InfluxDB UI , image

Through postman image

how to upload csv file by csv.from()?

sanderson commented 4 weeks ago

@songhaisheng98 For security reasons, InfluxDB restricts file system access at query time, so you can't use csv.from() to load CSV data from a file on disk using the InfluxDB UI. You can do it in the Flux REPL, which does allow access to the underlying filesystem. When using the Flux REPL, the Flux process runs independently from InfluxDB and is not limited by that restriction.

Another option would be to retrieve the CSV data using an HTTP request, formatting the response as a string, then using the CSV string with csv.from() to load the CSV data. The CSV file just needs to be made available via HTTP.