Giter Site home page Giter Site logo

dletta / fluxpipe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from metrico/fluxpipe

0.0 0.0 0.0 15.48 MB

Experimental Flux API/Pipeline for ClickHouse and other embedded datasources

Home Page: https://metrico.in

License: MIT License

Go 30.22% FLUX 67.86% Shell 1.92%

fluxpipe's Introduction

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


Instructions

Download a binary release or build from source

๐Ÿ“ฆ Download Binary

curl -fsSL github.com/lmangani/fluxpipe/releases/latest/download/fluxpipe-server -O && chmod +x fluxpipe-server

๐Ÿ”Œ Start Server w/ Options

./fluxpipe-server -port 8086

Run with -h for a full list of parameters


๐Ÿ› Usage

๐Ÿ’ก Check out the scripts folder for working examples


HTTP API

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!)

โญ ClickHouse SQL
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"])

image

image

โญ CURL POST

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

STDIN CMD

Fluxpipe can be used as a command-line tool and stdin pipeline processor

Generate CSV
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
Parse CSV
cat scripts/csv.flux | ./fluxpipe-server -stdin
Query SQL
cat scripts/sql.flux | ./fluxpipe-server -stdin

Status

  • Fluxlib
    • parser
    • executor
  • ClickHouse driver by @adubovikov
    • driver tests
  • STDIN pipeline
  • HTTP api
    • plaintext
    • json support
    • api doc

Footnotes

  1. Project is not affiliated or endorsed by Influxdata or Grafana Labs. All rights belong to their respective owners. โ†ฉ โ†ฉ2

fluxpipe's People

Contributors

dletta avatar lmangani avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.