Sign inSign up

backplane/sql-formatter

By backplane

•Updated about 12 hours ago

alpine:edge-based dockerization of sql-formatter the util for formatting SQL queries

Image
0

10K+

backplane/sql-formatter repository overview

⁠sql-formatter

alpine:edge⁠-based dockerization of sql-formatter⁠ the util for formatting SQL queries

As the site says:

SQL Formatter is a JavaScript library for pretty-printing SQL queries [...] SQL formatter supports the following dialects:

The source code for this image is hosted on GitHub in the backplane/conex repo⁠.

⁠Usage

⁠Interactive

The following shell function can assist in running this image interactively:


sql_formatter() {
  docker run \
    --rm \
    --interactive \
    --tty \
    --volume "$(pwd):/work" \
    "backplane/sql-formatter" \
    "$@"
}

when run interactively with the -h argument, the container produces the following usage text:

usage: sql-formatter [-h] [-o OUTPUT] [--fix]
                     [-l {bigquery,db2,hive,mariadb,mysql,n1ql,plsql,postgresql,redshift,spark,sqlite,sql,trino,transactsql,tsql,singlestoredb,snowflake}]
                     [-c CONFIG] [--version]
                     [FILE]

SQL Formatter

positional arguments:
  FILE                  Input SQL file (defaults to stdin)

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        File to write SQL output (defaults to stdout)
  --fix                 Update the file in-place
  -l {bigquery,db2,hive,mariadb,mysql,n1ql,plsql,postgresql,redshift,spark,sqlite,sql,trino,transactsql,tsql,singlestoredb,snowflake}, --language {bigquery,db2,hive,mariadb,mysql,n1ql,plsql,postgresql,redshift,spark,sqlite,sql,trino,transactsql,tsql,singlestoredb,snowflake}
                        SQL Formatter dialect (defaults to basic sql)
  -c CONFIG, --config CONFIG
                        Path to config json file (will use default configs if unspecified)
  --version             show program's version number and exit

Tag summary

Content type

Image

Digest

sha256:989997109…

Size

34.7 MB

Last updated

about 12 hours ago

docker pull backplane/sql-formatter