Home

Awesome

Graphic Walker DSL Parser

The project is currently in testing & validation. Welcome the community to raise issues and contribute code.

Introduction

./LICENSE

This project converts Graphic Walker DSL into SQL, which is needed for connecting Graphic Walker with databases/OLAP/data services. By integrating with Graphic Walker's server-side mode, it pushes down computations to the query engine for improved performance.

Quick Start

Regarding the definition of the Graphic Walker DSL and how to integrate it, please refer to the Graphic Walker documentation. Here we will focus on describing how to use the SDK.

Before integrating, we need to understand two parameters: Dataset and GraphicWalkerDSL.

For example:

package main

import (
	"github.com/kanaries/gw-dsl-parser/parser"
)

func main() {
	// refer to this doc on how to get the API Key: :https://github.com/Kanaries/pygwalker/wiki/How-to-get-api-key-of-kanaries%3F
	client := parser.NewClient("ak")
	
	// define the fields of the dataset
	fields := make(map[string]parser.Field)
	fields["col_1"] = parser.Field{
		Key:  "col_1",
		Fid:  "col_1",
		Type: parser.STRING,
	}
	// construct the dataset, name it "test_table"
	dataset := parser.NewDataset("test_table", fields, "mysql")

	// query from graphic walker request
	query := `
	{
	  "workflow": [
		{
		  "type": "view",
		  "query": [
			{
			  "op": "raw",
			  "fields": [
				"col_1"
			  ]
			}
		  ]
		}
	  ]
	}
	`
	sql, err := client.Parse(dataset, query)
	if err != nil {
		println(err)
	}
	println(sql)

}

Supported databases

How to run in other languages

Features

LICENSE

Please refer to LICENSE.