pims / prql-go

Go library to compile PRQL to SQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prql-go is a cgo-free alternative to https://github.com/PRQL/prql/blob/main/prql-lib/README.md

It uses https://github.com/tetratelabs/wazero as a WASM runtime to compile PRQL to SQL

$ go get github.com/pims/prql-go
import "github.com/pims/prql-go"
ctx := context.Background()
w, err := prql.New(ctx)
if err != nil {
    fmt.Println(err)
    os.Exit(1)
}
defer w.Close(ctx)

sql, err := w.Compile(ctx, "from employees | select [name,age]")
if err != nil {
    fmt.Println(err)
    os.Exit(1)
}
fmt.Println(sql)
// SELECT
//   name,
//   age
// FROM
//   employees

The prql-wasi.wasm file comes from https://github.com/pims/prql-wasi

About

Go library to compile PRQL to SQL


Languages

Language:Go 100.0%