sqlformat Beautifier
About
sqlformat beautifier for Unibeautify
Package | Docs | Latest |
---|---|---|
@unibeautify/beautifier-sqlformat | v0.0.1 | |
unibeautify | v0.17.1 |
Prerequisites
Please install the following prerequisites.
sqlformat executable
sqlformat executable should not be confused with sqlformat beautifier with the same name. Executables are non-Node.js tools for code formatting while beautifiers are Node.js packages which wrap an executable to be used by Unibeautify.
sqlformat executable is a third-party program you must install manually and is required for beautification.
See https://github.com/andialbrecht/sqlparse for more information.
Install sqlformat (sqlformat
) by following https://github.com/andialbrecht/sqlparse.
If you have questions or want to report a bug, go to https://github.com/andialbrecht/sqlparse/issues.
Install
Install with npm
:
npm install --save-dev unibeautify @unibeautify/beautifier-sqlformat
Or with yarn
:
yarn add --dev unibeautify @unibeautify/beautifier-sqlformat
Usage
Add sqlformat
to beautifiers
language option.
A .unibeautifyrc.json
file would look like the following:
{
"SQL": {
"beautifiers": [
"sqlformat"
]
}
}
Advanced
Example advanced configuration:
{
"SQL": {
"beautifiers": [
"sqlformat"
],
"sqlformat": {
"sqlformat": {
"path": "/absolute/path/to/sqlformat"
}
}
}
}
Options
Option | SQL |
---|---|
Identifier Case | ✅ |
Indent Size | ✅ |
Keyword Case | ✅ |
FAQ
How to use sqlformat in Atom, VSCode, and other editors?
See the editor integration documentation for installation instructions for your editor of choice.
How to enable sqlformat to format on save?
See the editor integration documentation for format on save instructions for your editor of choice.
How to run sqlformat on all files?
You can run sqlformat on all of your files for every commit with Unibeautify CI.
Is there a sqlformat sandbox or playground?
You can quickly try sqlformat online with Unibeautify Playground.
Troubleshooting
Below are instructions for each of the supported Operating Systems.
Windows
Open the Command Prompt.
Show me how to open the Command Prompt.
Find the path to sqlformat by running the command:
where sqlformat
Which will return an absolute path like one of the following:
C:\absolute\path\to\sqlformat
C:\absolute\path\to\sqlformat.exe
C:\absolute\path\to\sqlformat.bat
If where
fails to return an executable path then you need to fix your PATH
Environment Variable.
Show me how to change my
PATH
environment variable.
If you know the executable path go to the Configure section and replace /absolute/path/to/sqlformat
with your specific executable path value.
macOS
Open the Terminal application.
Show me how to open the Terminal.
Find the path to sqlformat by running the command:
which sqlformat
Which will return an absolute path like one of the following:
/absolute/path/to/sqlformat
/absolute/path/to/sqlformat.sh
/absolute/path/to/sqlformat.bash
If which
fails to return an executable path then you need to fix your PATH
Environment Variable:
Show me how to change my
PATH
environment variable.
If you know the executable path go to the Configure section and replace /absolute/path/to/sqlformat
with your specific executable path value.
Linux
Open the Terminal application.
Show me how to open the Terminal.
Find the path to sqlformat by running the command:
which sqlformat
Which will return an absolute path like one of the following:
/absolute/path/to/sqlformat
/absolute/path/to/sqlformat.sh
/absolute/path/to/sqlformat.bash
If which
fails to return an executable path then you need to fix your PATH
Environment Variable.
Show me how to change my
PATH
environment variable.
If you know the executable path go to the Configure section replace /absolute/path/to/sqlformat
with your specific executable path value.