Skip to content

ZetaSQL (Standard SQL) Formatter with preserved comments mainly for BigQuery and SpanSQL

License

Notifications You must be signed in to change notification settings

Matts966/zetasql-formatter

 
 

Repository files navigation

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.

About

ZetaSQL (Standard SQL) Formatter with preserved comments mainly for BigQuery and SpanSQL

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 86.7%
  • Java 6.4%
  • Python 3.0%
  • Starlark 2.0%
  • Yacc 1.7%
  • Lex 0.2%