Skip to content

SQL Layer External dependenciesλ︎

Linting and formatting of SQL queries is supported via externally installed binaries.

SQL layer and LSP page documents installation of an LSP Server binary for the SQL layer

SQLint Linting toolλ︎

The sqlint tool provides SQL syntax checking in Emacs via Flycheck.

Install ruby and the sqlint gem.

gem install sqlint

Add Git pre-commit hookλ︎

When committing queries it is useful to define a Git pre-commit hook to check the syntax of the query before the commit completes

If using pre-commit to manage hooks, edit the Git .pre-commit-hooks.yaml

- repo: https://github.com/purcell/sqlint
  rev: master
  hooks:
  - id: sqlint

SQLfmt formatting toolλ︎

Formatting: Install sqlfmt and move it into your $PATH

Download and extract the binary 0.4.0 for linux

wget -q -O - https://github.com/mjibson/sqlfmt/releases/latest/download/sqlfmt_0.4.0_linux_amd64.tar.gz | tar -xpvzf - --directory "${installdir}/bin"