FluxPipe is a very experimental stand-alone Flux API for ClickHouse and other embedded datasources
Flux is a lightweight scripting language for querying databases and working with data. 1
Download a binary release or build from source
curl -fsSL github.com/lmangani/fluxpipe/releases/latest/download/fluxpipe-server -O && chmod +x fluxpipe-server
./fluxpipe-server -port 8086
Run with -h
for a full list of parameters
๐ก Check out the scripts folder for working examples
Fluxpipe serves a simple REST API loosely compatible with existing flux integrations and clients
Grafana Flux 1
Usage with native Grafana InfluxDB/Flux datasource (url + organization fields are required!)
import "sql"
sql.from(
driverName: "clickhouse",
dataSourceName: "clickhouse://default:@clickhouse-host:9000/system",
query: "SELECT database, total_rows FROM tables WHERE total_rows > 0"
)
|> rename(columns: {database: "_value", total_rows: "_data"})
|> keep(columns: ["_value","_data"])
Usage with curl
curl -XPOST localhost:8086/api/v2/query -sS \
-H 'Accept:application/csv' \
-H 'Content-type:application/vnd.flux' \
-d 'import g "generate" g.from(start: 2022-04-01T00:00:00Z, stop: 2022-04-01T00:03:00Z, count: 3, fn: (n) => n)'
#datatype,string,long,dateTime:RFC3339,long
#group,false,false,false,false
#default,_result,,,
,result,table,_time,_value
,,0,2022-04-01T00:00:00Z,1
,,0,2022-04-01T00:00:36Z,2
,,0,2022-04-01T00:01:12Z,3
Fluxpipe can be used as a command-line tool and stdin pipeline processor
echo 'import g "generate" g.from(start: 2022-04-01T00:00:00Z, stop: 2022-04-01T00:03:00Z, count: 5, fn: (n) => 1)' \
| ./fluxpipe-server -stdin
#datatype,string,long,dateTime:RFC3339,long
#group,false,false,false,false
#default,_result,,,
,result,table,_time,_value
,,0,2022-04-01T00:00:00Z,1
,,0,2022-04-01T00:00:36Z,1
,,0,2022-04-01T00:01:12Z,1
,,0,2022-04-01T00:01:48Z,1
,,0,2022-04-01T00:02:24Z,1
cat scripts/csv.flux | ./fluxpipe-server -stdin
cat scripts/sql.flux | ./fluxpipe-server -stdin
- Fluxlib
- parser
- executor
- ClickHouse driver by @adubovikov
- driver tests
- STDIN pipeline
- HTTP api
- plaintext
- json support
- api doc