Welcome to Prettier SQL, a Visual Studio Code extension that formats SQL code. This extension helps you maintain clean and consistent SQL code formatting, making it easier to read and understand.
Prettier SQL supports various SQL dialects, including:
auto,sql,bigquery,clickhouse,db2,db2i,duckdb,hive,mariadb,mysql,tidb,n1ql,plsql,oracle,postgresql,redshift,singlestoredb,snowflake,spark,sqlite,mssql,mssqlserver,transactsql,trino
-
Install:
git clone https://github.com/olton/prettier-sql.git cd prettier-sql -
Build extension sources:
npm run build
-
Open this project in VS Code and press
F5to start the Extension Development Host.
- Open a
.sqlfile. - Run
Format Documentor commandPrettierSQL: Format. - Optionally select part of SQL and run
Format Selectionfor range formatting. - Configure behavior in VS Code settings with these options:
prettiersql.enableprettiersql.tabSizeprettiersql.useTabsprettiersql.singleQuoteprettiersql.operatorNewLineprettiersql.operatorCase(none|upper|lower)prettiersql.dialect
The extension uses sql-formatter under the hood and applies the options above during formatting.
When prettiersql.dialect is auto, the formatter infers a dialect from current editor language id.
Contributions are welcome. Feel free to submit a pull request or open an issue.
If you like this project, please consider supporting it by:
- Star this repository on GitHub
- Sponsor this project on GitHub Sponsors
- PayPal to
serhii@pimenov.com.ua. - Patreon
- Buy me a coffee
Copyright (c) 2026 by Serhii Pimenov. All Rights Reserved.