Skip to content

Latest commit

 

History

History
88 lines (68 loc) · 4.57 KB

README.md

File metadata and controls

88 lines (68 loc) · 4.57 KB

PartiQL Playground (Proof of Concept)

PartiQL Playground provides the functionality to execute PartiQL in a web environment.

Please note, at this stage, the code as is in this package is considered experimental and should not be used for production.

🙌 Checkout the playground now 🙌.

Development

This Branch contains Rust Code for WASM generation.

PartiQL Playground uses WebAssembly (Wasm) for integrating the front-end with PartiQL Rust back-end.

Upon merging pull request, the GitHub action will automatically create a new pull request towards react-website branch.

The React Website branch contains code for the experimental web application.

To run test:


Build and run the website application (Locally)

  1. Checkout main branch and develop
  2. Build the package using make
make build
  1. Port the wasm files to react wesbite branch
git checkout -b temp
make buid
rm pkg-web/.gitignore
git add .
git commit -m "adding pkg-web to git"
git checkout react-website
git checkout temp -- pkg-web
git add pkg-web
git commit -m "wasm update"
  1. Build the react website branch
npm i
npm run serve

Docker Build

make container-build
make container-run

Restful API

# Example for parsing `SELECT * FROM {'a': 1}` statement
curl -H 'Content-Type: application/json; charset=UTF-8' \
  -H "Accept: application/json" \
  --data '{"query": "SELECT * FROM {'a': 1}"}' \
  -X POST http://localhost:8000/parse

"{\"text\":\"SELECT * FROM {a: 1}\",\"offsets\":{\"line_starts\":[0]},\"ast\":{\"Query\":{\"id\":9,\"node\":{\"set\":{\"id\":8,\"node\":{\"Select\":{\"id\":7,\"node\":{\"project\":{\"id\":1,\"node\":{\"kind\":\"ProjectStar\",\"setq\":\"All\"}},\"from\":{\"id\":6,\"node\":{\"source\":{\"FromLet\":{\"id\":5,\"node\":{\"expr\":{\"Struct\":{\"id\":4,\"node\":{\"fields\":[{\"first\":{\"VarRef\":{\"id\":2,\"node\":{\"name\":{\"value\":\"a\",\"case\":\"CaseInsensitive\"},\"qualifier\":\"Unqualified\"}}},\"second\":{\"Lit\":{\"id\":3,\"node\":{\"Int64Lit\":1}}}}]}}},\"kind\":\"Scan\",\"as_alias\":null,\"at_alias\":null,\"by_alias\":null}}}}},\"from_let\":null,\"where_clause\":null,\"group_by\":null,\"having\":null}}}},\"order_by\":null,\"limit\":null,\"offset\":null}}},\"locations\":{\"1\":{\"start\":0,\"end\":8},\"2\":{\"start\":15,\"end\":16},\"3\":{\"start\":18,\"end\":19},\"4\":{\"start\":14,\"end\":20},\"5\":{\"start\":14,\"end\":20},\"6\":{\"start\":9,\"end\":20},\"7\":{\"start\":0,\"end\":20},\"8\":{\"start\":0,\"end\":20},\"9\":{\"start\":0,\"end\":20}}}"%

# Example for explaining (logical planning) `SELECT * FROM {'a': 1}` statement
curl -H 'Content-Type: application/json; charset=UTF-8' \
  -H "Accept: application/json" \
  --data '{"query": "SELECT * FROM {'a': 1}"}' \
  -X POST http://localhost:8000/explain

"\"LogicalPlan { nodes: [ProjectAll, Scan(Scan { expr: TupleExpr(TupleExpr { attrs: [VarRef(CaseInsensitive(\\\"a\\\"))], values: [Lit(1)] }), as_key: \\\"_1\\\", at_key: None }), Sink], edges: [(OpId(2), OpId(1), 0), (OpId(1), OpId(3), 0)] }\""%

# Example for evaluating `SELECT * FROM env` statement
curl -H 'Content-Type: application/json; charset=UTF-8' \
  -H "Accept: application/json" \
  --data '{"query": "SELECT * FROM env", "env": "{'\''env'\'' : <<{'\''a'\'': 1,'\''b'\'': 2 }>>}"}' \
  -X POST http://localhost:8000/eval

"{\"Ok\":{\"Bag\":[{\"Tuple\":{\"attrs\":[\"a\",\"b\"],\"vals\":[{\"Integer\":1},{\"Integer\":2}]}}]}}"%  

Dependencies

Package License
wasm-bindgen Apache License Version 2.0
wasm-pack Apache License Version 2.0
node MIT License
body-parser MIT License