$npx skillfedfor your agent

sql-formatter

A SQL formatter

With conditionsPyPI Text ProcessingReleased May 2021854.6K downloads / moApache Software License 2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — sql_formatter-0.6.2-py3-none-any.whl
v0.6.2 · released 2021-05-01 · Python >=3.6

Yes, if you need a lightweight, dependency-free SQL formatter for SELECT and CREATE statements and can tolerate an unmaintained codebase. The permissive Apache license and zero runtime dependencies make it low-friction to add. However, do not rely on it for production systems handling modern SQL dialects or requiring ongoing support—test thoroughly with your SQL patterns first, and consider alternatives if you need active maintenance or broader SQL command support.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.6 or later.
  • SQL statements must end with a semicolon for the formatter to work correctly.
  • No runtime dependencies and a pure-Python wheel distribution make installation straightforward.

License · maintenance · safety

Apache Software License 2.0 (permissive) — Licensed under Apache Software License 2.0 (permissive), so you may use, modify, and distribute the package freely in both open-source and commercial projects with minimal restrictions.

last release 2021-05-01 (1931 days) · last repo commit 2022-04-30 · 46 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 854,612 downloads/mo, #4,894 on PyPI

Verify before relying

pip install sql-formatter

from sql_formatter.core import format_sql
formatted = format_sql("select a, b from table1 where a = 1")
print(formatted)
  • Whether the formatter handles modern SQL dialects (PostgreSQL, BigQuery, Snowflake, etc.) or only generic SQL syntax.
  • Whether the package works reliably with Python versions newer than 3.8, given the abandonment status.
  • Performance characteristics when formatting very large SQL files or deeply nested subqueries.
Same gist for agents: .md · .json

What it is and what it does

sql-formatter is a Python-based command-line and library tool that reformats SQL queries into a standardized, readable layout. It uses indentation and case normalization (uppercasing keywords, lowercasing identifiers) to enhance readability and make query structure immediately apparent. The formatter handles SELECT and CREATE TABLE/VIEW statements, including subqueries and joins, and can be invoked from the command line on individual files or batches, integrated into pre-commit hooks, or called directly from Python code.

The package includes basic validation to catch common mistakes like forgotten semicolons, unbalanced parentheses, and mismatched CASE/WHEN/END blocks. It does not parse SQL into data structures, validate queries against a specific database system, or format other SQL commands like INSERT or UPDATE. The project is no longer actively maintained as of April 2022, so it may not reflect current SQL standards or work seamlessly with the latest Python versions.

Use it for

  • Format SQL files in a pre-commit hook to enforce consistent styling across a team's repository.
  • Reformat ad-hoc or poorly formatted SQL queries in Python scripts to improve readability before review or deployment.
  • Batch-process a directory of SQL files to standardize indentation and keyword casing across a legacy codebase.
  • Integrate into a data pipeline to normalize query formatting for logging or audit purposes.
  • Use as a command-line tool to quickly beautify SQL files during development without leaving the terminal.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you need a lightweight, dependency-free SQL formatter for SELECT and CREATE statements and can tolerate an unmaintained codebase.

The permissive Apache license and zero runtime dependencies make it low-friction to add. However, do not rely on it for production systems handling modern SQL dialects or requiring ongoing support—test thoroughly with your SQL patterns first, and consider alternatives if you need active maintenance or broader SQL command support.

Install

sql-formatter on PyPI

Before you install

No runtime dependencies and a pure-Python wheel distribution make installation straightforward. However, the project has been abandoned since April 2022 with no updates for nearly two years, so maintenance and compatibility with newer Python versions or SQL dialects is not guaranteed.

Requires Python 3.6 or later. SQL statements must end with a semicolon for the formatter to work correctly.

License in practice

Licensed under Apache Software License 2.0 (permissive), so you may use, modify, and distribute the package freely in both open-source and commercial projects with minimal restrictions.

Quickstart

pip install sql-formatter

from sql_formatter.core import format_sql
formatted = format_sql("select a, b from table1 where a = 1")
print(formatted)

Verify before relying

  • Whether the formatter handles modern SQL dialects (PostgreSQL, BigQuery, Snowflake, etc.) or only generic SQL syntax.
  • Whether the package works reliably with Python versions newer than 3.8, given the abandonment status.
  • Performance characteristics when formatting very large SQL files or deeply nested subqueries.

Package facts

LicenseApache Software License 2.0 permissive
Python supportSupports the current Python release >=3.6
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceAbandoned 1,931 days since the last release
Last repo commit
First released
Downloads854,612 / month, #4,894 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8

Evidence: sql_formatter-0.6.2-py3-none-any.whl

Tags

Capabilities
sql formatting toolsql query beautifiersql code formatterstandardize sql syntaxsql readability toolformat sql filessql indentation
Topics
sql-formattingcode-stylecli-tool
PyPI keywords
SQLformatter

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “sql query beautifier”

  • sql-formatterReformats SQL queries into standardized, readable form with…
  • shandy-sqlfmtA command-line SQL formatter that automatically reformats SQL files…
  • cssbeautifierBeautifies, unpacks, and deobfuscates CSS code to make it…

Give your agent the search over MCP, or paste the wish link into any chat.

More Text Processing packages

regex Worth it
PyPI · Python Modules · released Jul 2026

A drop-in replacement for Python's standard `re` module that adds advanced regex features like nested sets, fuzzy matching, lookaround in conditionals, and full Unicode case-folding while maintaining backward compatibility.

Apache-2.0 AND CNRI-Pythoncompiled wheel · 3.10+
437.7Mdownloads / mo
pyparsing Worth it
PyPI · Text Processing · released Jan 2026

pyparsing provides a library for building text parsers directly in Python code using composable grammar classes, handling quoted strings, whitespace variation, and embedded comments without regex or lex/yacc.

Install it if you need to parse text or define grammars programmatically.

MITpure Python · 3.9+
412.7Mdownloads / mo
fonttools Worth it
PyPI · Text Processing · released May 2026

fonttools manipulates font files in multiple formats (TrueType, OpenType, AFM, Type 1, Mac-specific) and includes TTX, a tool to convert fonts to and from XML text format.

Install it if you need to read, write, or manipulate fonts programmatically or via the TTX command-line tool.

permissive licensepure Python · 3.10+
235.9Mdownloads / mo
docutils With conditions
PyPI · Software Development · released May 2026

Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.

BSD-3-Clausepure Python · 3.9+
225.6Mdownloads / mo
RapidFuzz Worth it
PyPI · Text Processing · released Apr 2026

RapidFuzz provides fast fuzzy string matching using Levenshtein Distance and related metrics, implemented mostly in C++ with Python bindings for rapid similarity scoring and approximate string matching.

Install it if you need fuzzy string matching; it's a solid replacement for FuzzyWuzzy with better licensing and performance.

MITcompiled wheel · 3.10+
184.2Mdownloads / mo
tinycss2 Worth it
PyPI · Text Processing · released Nov 2025

tinycss2 parses CSS strings into token and block objects, and generates CSS strings from those objects, following the CSS Syntax Level 3 specification without enforcing specific properties or values.

Install it if your project requires CSS tokenization or syntax manipulation.

BSD-3-Clausepure Python · 3.10+
113.2Mdownloads / mo

See also sqlvalidator · pgsanity · sqlglot · sqlparse · sqlglotrs · config-formatter · moz-sql-parser · shandy-sqlfmt · acryl-sqlglot · sqlglotc