# andialbrecht/sqlparse

A non-validating SQL parser module for Python

Repository: https://github.com/andialbrecht/sqlparse
Canonical: https://ross.abutalabs.com/products/sqlparse
Language: Python
License: BSD-3-Clause
License Family: permissive
Topics: formatter, python, sql, sql-formatter, sql-parser, tokenizer
Last push: 2026-08-13T19:17:19+00:00

## Health v2 (maintenance only)
Score: 76/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 97, release rhythm 35, longevity 100
- inputs: {"age_days": 5250, "days_push": 20, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 4014, forks 740 (observed 2026-08-28T04:08:32.383074+00:00)

## What it is
sqlparse is a non-validating SQL parser library for Python that tokenizes SQL text, splits scripts into statements, formats them, and exposes a traversable token tree. It makes no dialect assumptions, so vendor extensions and templated SQL parse fine, and it also ships a sqlformat command-line tool.

## Use cases
- parse SQL statements in Python
- format and pretty-print SQL queries
- split a SQL script into individual statements
- build a SQL linter or query analyzer
- reformat SQL files from the command line
- inspect the token structure of a SQL query

## When to choose
- you need to parse, split, or reformat SQL without strict validation
- you work with mixed or non-standard SQL dialects and templated SQL
- you're building tooling like formatters, linters, or editors on top of SQL text

## When to avoid
- you need full SQL validation or a complete syntax/semantic parse tree
- you need to execute queries or need a database driver
- you need dialect-specific ASTs with exact grammar rules

## Facets
- artifact type: library
- maturity: stable
- function: parser, formatter, cli
- domain: parsers, databases, developer-tools
- platform: python, cli, cross-platform
- tags: sql, tokenizer, sql-formatter, non-validating-parser

## Member repositories
- andialbrecht/sqlparse (main) score 76

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:32.383074+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:23:59.641858+00:00, confidence not recorded.
  - readme: https://github.com/andialbrecht/sqlparse (fetched 2026-08-28T04:08:32.383074+00:00, sha 93b49844a216)
  - registry_pypi: https://pypi.org/pypi/sqlparse/json (fetched 2026-08-29T09:16:45.750450+00:00, sha ad683f985bbe)
- Data as of 2026-08-30T08:39:29.467469+00:00.
