[WIP] zetasql-server is parsing/analyzing ZetaSQL using google/zetasql framework.
$ docker pull naoto0822/zetasql-server:latest
$ docker run -p 8080:8080 -t naoto0822/zetasql-server
TODO: DebugString to JSON format...
Returns a list of ZetaSQL AST DebugString or error message.
- example
$ curl -X POST -H 'Content-type: application/text' --data 'SELECT 1' http://localhost:8080/parse
QueryStatement [0-8]
Query [0-8]
Select [0-8]
SelectList [7-8]
SelectColumn [7-8]
IntLiteral(1) [7-8]
$ curl -X POST -H 'Content-type: application/text' --data 'SEL 1' http://localhost:8080/parse
generic::invalid_argument: Syntax error: Unexpected identifier "SEL" [zetasql.ErrorLocation] { line: 1 column: 1 }
Format SQL.
- example
$ curl -X POST -H 'Content-type: application/text' --data 'SELECT * FROM hoge' http://localhost:8080/format
SELECT
*
FROM
hoge;
$ curl -X POST -H 'Content-type: application/text' --data 'SEL 1' http://localhost:8080/format
generic::invalid_argument: Syntax error: Unexpected identifier "SEL" [at 1:1]
SEL 1
^
Returns whether it is correct.
- example
$ curl -X POST -H 'Content-type: application/text' --data 'SELECT 1' http://localhost:8080/valid
OK
$ curl -X POST -H 'Content-type: application/text' --data 'SEL 1' http://localhost:8080/valid
generic::invalid_argument: Syntax error: Unexpected identifier "SEL" [zetasql.ErrorLocation] { line: 1 column: 1 }
$ make run
If creating Github Release of new tag, CI push new docker image.
- Format sql
- Multi Statements
- Analyze SQL
- AST to JSON (DebugString to struct)
- cli tool -> https://github.com/naoto0822/zetasql-cli (still private...)
-
Hosting VPS or Web assembly - gazelle
- zetasql base image
- bazel