sqlfmt

SQL Formatter

  • Owner: jackc/sqlfmt
  • Platform:
  • License:: Apache License 2.0
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

sqlfmt

Installation

$ go get github.com/jackc/sqlfmt/...
$ which sqlfmt
$GOPATH/bin/sqlfmt

Usage

  • You can either:

    • Provide the path to one or more SQL files as command line arguments:

      $ sqlfmt testdata/select_where.input.sql
      select
        foo,
        bar
      from
        baz
      where
        foo > 5
        and bar < 2
      
    • Or, directly provide the SQL string via stdin:

      $ echo "select * from users", sqlfmt
      select
        *
      from
        users
      
      $ sqlfmt < testdata/like.input.sql
      select
        foo,
        bar
      from
        baz
      where
        foo like 'abd%'
        or foo like 'ada%' escape '!'
        or foo not like 'abd%'
        or foo not like 'ada%' escape '!'
        or foo ilike 'efg%'
        or foo ilike 'ada%' escape '!'
        or foo not ilike 'efg%'
        or foo not ilike 'ada%' escape '!'
      
  • View testdata for more examples.

Main metrics

Overview
Name With Ownerjackc/sqlfmt
Primary LanguageYacc
Program languageGo (Language Count: 2)
Platform
License:Apache License 2.0
所有者活动
Created At2015-06-13 17:31:09
Pushed At2019-12-21 21:12:51
Last Commit At2019-12-21 15:12:49
Release Count2
Last Release Namev0.1.0 (Posted on )
First Release Namev0.0.1 (Posted on )
用户参与
Stargazers Count337
Watchers Count9
Fork Count25
Commits Count199
Has Issues Enabled
Issues Count6
Issue Open Count3
Pull Requests Count4
Pull Requests Open Count1
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private