Skip to content

Latest commit

 

History

History
70 lines (54 loc) · 1.71 KB

README.md

File metadata and controls

70 lines (54 loc) · 1.71 KB

ZetaSQL Formatter

build

This repository is forked from google/zetasql and provides SQL formatter with preserved comments. This formatter can be applied to mainly BigQuery and SpanSQL.

Quick Start

# 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

version: 2
tools:
  zetasql-formatter: &zetasql-formatter
    format-command: zetasql-formatter
    format-stdin: true
languages:
  sql:
    - <<: *zetasql-formatter
  sql-bigquery:
    - <<: *zetasql-formatter

License

Apache License 2.0

Sponsors

The development of this formatter is sponsored by the Japan Data Science Consortium.