Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kanaries/gw-dsl-parser
Generate SQL from Graphic Walker visualization DSL
https://github.com/kanaries/gw-dsl-parser
sql visualization
Last synced: 2 months ago
JSON representation
Generate SQL from Graphic Walker visualization DSL
- Host: GitHub
- URL: https://github.com/kanaries/gw-dsl-parser
- Owner: Kanaries
- License: apache-2.0
- Created: 2023-08-04T06:34:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-23T06:09:51.000Z (11 months ago)
- Last Synced: 2024-03-15T21:05:31.917Z (10 months ago)
- Topics: sql, visualization
- Language: Go
- Homepage:
- Size: 1.76 MB
- Stars: 9
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Graphic Walker DSL Parser
> The project is currently in testing & validation. Welcome the community to raise issues and contribute code.
## Introduction
![./LICENSE](https://img.shields.io/github/license/kanaries/gw-dsl-parser?style=flat-square)
[![](https://img.shields.io/badge/twitter-kanaries_data-03A9F4?style=flat-square&logo=twitter)](https://twitter.com/kanaries_data)
[![](https://img.shields.io/discord/987366424634884096?color=%237289da&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/WWHraZ8SeV)
[![](https://img.shields.io/badge/Slack-green?style=flat-square&logo=slack&logoColor=white)](https://kanaries-community.slack.com/join/shared_invite/zt-20hho6t45-_OSDdTQamnrSnOW6C2PTgg)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.
* Leverage the query engine for faster processing instead of pulling all data to the application layer
* Reduce data transfer between database and application server
* Allow users to analyze data using their own databases## 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`.
- `GraphicWalkerDSLDSL`: `GraphicWalkerDSL` is the serialized DSL obtained by passing GraphicWalker directly to the backend.
- `Dataset` is your abstraction of the data source.For example:
- If you want to query a Mysql table called ***"test_table"***, you need to define the `Dataset` as follows:
```go
package mainimport (
"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
- [x] Postgresql
- [x] DuckDB
- [x] Snowflake
- [x] MySQL
- [x] BigQuery
- [x] ClickHouse
## How to run in other languages
- python: https://github.com/Kanaries/gw-dsl-parser-py
- js: https://www.npmjs.com/package/@kanaries/gw-dsl-parser
## Features- More database support ( Snowflake, ClickHouse, etc.)
- SQL syntax compatibility test## LICENSE
Please refer to [LICENSE](https://github.com/Kanaries/gw-dsl-parser/blob/main/LICENSE).