This repository is forked from google/zetasql and provides SQL formatter with preserved comments. This formatter can be applied to mainly BigQuery and SpanSQL.
# To install for MacOSX
wget https://github.com/Matts966/zetasql-formatter/releases/latest/download/zetasql-formatter_darwin_amd64.zip \
&& sudo unzip zetasql-formatter_darwin_amd64.zip -d /usr/local/bin
# To install for Linux
wget https://github.com/Matts966/zetasql-formatter/releases/latest/download/zetasql-formatter_linux_x86_64.zip \
&& sudo unzip zetasql-formatter_linux_x86_64.zip -d /usr/local/bin
# To apply formatter for files
$ zetasql-formatter [files and directories]
# Format stdin
$ echo "select * from test" | zetasql-formatter
SELECT
*
FROM
test;
$ zetasql-formatter
select * from ok;
-- CTRL-D
SELECT
*
FROM
ok;
-- CTRL-D
Integration with efm-langserver
- Install efm-langserver
- Locate
config.yaml
like below
version: 2
tools:
zetasql-formatter: &zetasql-formatter
format-command: zetasql-formatter
format-stdin: true
languages:
sql:
- <<: *zetasql-formatter
sql-bigquery:
- <<: *zetasql-formatter
The development of this formatter is sponsored by the Japan Data Science Consortium.