A JavaScript library for pretty-printing SQL queries across multiple database dialects.
SQL Formatter is a JavaScript library that automatically formats SQL queries with proper indentation and whitespace. It solves the problem of inconsistent and hard-to-read SQL code by applying a consistent style across multiple database dialects, making queries easier to understand and maintain.
Developers, data engineers, and database administrators who write SQL regularly and need to ensure their queries are clean and readable, especially in team environments or when working with multiple SQL dialects.
Developers choose SQL Formatter for its extensive dialect support, high configurability, and ease of integration into existing workflows via CLI, libraries, and editor plugins, providing a robust solution for SQL formatting without being tied to a specific database.
A whitespace formatter for different query languages
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports over 15 SQL dialects including PostgreSQL, MySQL, and Snowflake, making it versatile for multi-database projects, as detailed in the language options.
Offers numerous configuration options like indentation, keyword casing, and line spacing, allowing precise control over output style, evidenced by the comprehensive docs for each option.
Provides CLI, official VSCode extension, and support for Prettier and ESLint, fitting easily into existing developer workflows without heavy setup.
Can replace prepared statement placeholders with actual values during formatting, useful for debugging and documentation, as shown in the params option examples.
Does not support stored procedures or changing delimiters, as admitted in the README, restricting its use for complex database scripts and legacy code.
Development is in maintenance mode with only bug fixes, meaning no new features or dialect updates are likely, limiting long-term viability for evolving projects.
Requires explicit dialect specification to avoid parse errors, which can be a pitfall for users with mixed or ambiguous SQL code, as noted in the FAQ.