{"repo":"sql-formatter-org/sql-formatter","free":true,"listed":false,"github":"https://github.com/sql-formatter-org/sql-formatter","clone":"git clone https://github.com/sql-formatter-org/sql-formatter.git","description":"A whitespace formatter for different query languages","language":"TypeScript","stars":2883,"topics":["sql","formatter","n1ql","javascript"],"license":"MIT","category":"databases-storage","readme_excerpt":"SQL Formatter SQL Formatter is a JavaScript library for pretty-printing SQL queries. It started as a port of a [PHP Library][], but has since considerably diverged. It supports various SQL dialects: GCP BigQuery, Clickhouse, IBM DB2, DuckDB, Apache Hive, MariaDB, MySQL, TiDB, Couchbase N1QL, Oracle PL/SQL, PostgreSQL, Amazon Redshift, SingleStoreDB, Snowflake, Spark, SQL Server Transact-SQL, Trino (and Presto). See language option docs for more details. It does not support: - Stored procedures. - Changing of the delimiter type to something else than ; . → Try the demo. Install Get the latest version using your package manager of choice: Usage Usage as library This will output: You can also pass in configuration options: Disabling the formatter You can disable the formatter for a section of SQL by surrounding it with disable/enable comments: which produces: The formatter doesn't even parse the code between these comments. So in case there's some SQL that happens to crash SQL Formatter, you can comment the culprit out (at least until the issue gets fixed in SQL Formatter). Placeholders replacement In addition to formatting, this library can also perform placeholder replacement in prepared SQL statements: Results in: For more details see docs of params option. Usage from command line The CLI tool will be installed under sql-formatter and may be invoked via npx sql-formatter : By default, the tool takes queries from stdin and processes them to stdout but one can also name an inpu","default_branch":null,"files":null,"tree":[],"storefront":"/r/sql-formatter-org","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sql-formatter-org/sql-formatter/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}