pypi / sqlparse
sqlparse
What changed in sqlparse 0.5 to 0.6, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-20.
2 breaking12 security1 new APIs and options4 tooling16 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initsqlparse 0.618 changes
Breaking changes 1
Support for Python 3.8 and 3.9 is dropped; Python 3.10 or newer is required.
Security 9
Fixes a denial-of-service issue affecting statements that consist only of comments.
Fixes quadratic CPU consumption on statements containing many unclosed dollar-quoted literals or multiline comments.
Backslashes are now escaped in this output format so SQL containing a backslash cannot break out of the generated string literal.
sqlparse: Generated Python and PHP snippets allow SQL string breakout through unescaped backslashes
sqlparse: Inefficient Regex Handling of Dollar-Quoted SQL Literals Leads to ReDoS (Denial of Service)
sqlparse: Quadratic O(n²) DoS in group_comments
sqlparse: Reindentation of tuple lists causes near-cap quadratic CPU consumption
sqlparse: TokenList.__init__ materializes O(subtree) value per group, causing CPU DoS before depth/token caps trigger
Fixes excessive CPU use when grouping deeply nested or very wide statements.
Tooling 1
Type annotations on top-level API functions now use PEP 585 and PEP 604 syntax.
Fixes and other changes 7
A keyword followed by a float literal without a leading zero is no longer reclassified as an identifier, so bounds such as .03 and .06 parse as numbers.
These SQL constructs are now recognized as keywords.
Function grouping is no longer skipped in CREATE TABLE ... AS SELECT statements when the as keyword is lowercase.
Fixes name extraction for names with more than two dotted parts.
Recognizing MATERIALIZED as a keyword makes CREATE MATERIALIZED VIEW statements parse and format consistently.
Recognizing ROW_FORMAT as a keyword prevents the table name and option from merging into one identifier in ALTER TABLE statements.
Fixes a late-binding closure bug in TokenList.token_not_matching.
sqlparse 0.517 changes
Breaking changes 1
Grouping limits now raise SQLParseError instead of silently returning None, allowing developers to handle the error.
Security 3
A configurable grouping-depth limit adds protection against denial of service attacks and can be adjusted or disabled by setting it to None.
A configurable token-processing limit adds protection against denial of service attacks and can be adjusted or disabled by setting it to None.
sqlparse: formatting list of tuples leads to denial of service
New APIs and options 1
The CLI adds --in-place for editing SQL files in place.
Tooling 3
A py.typed marker enables PEP 561 compliance and type checking with mypy and other tools.
The CLI can now be used as a pre-commit hook to automatically format SQL files and accepts multiple files.
Top-level API functions now have type annotations, enabling type checking with mypy and other tools.
Fixes and other changes 9
Splitting of BEGIN TRANSACTION statements is fixed.
ATTACH is now recognized as a PostgreSQL keyword.
DETACH is now recognized as a PostgreSQL keyword.
INTERSECT is now recognized among close keywords in a WHERE clause.
sqlparse now supports Python 3.14.
REGEXP BINARY is now supported as a comparison operator.
Splitting statements with nested BEGIN ... END blocks is fixed.
Fixed splitting statements with IF EXISTS or IF NOT EXISTS inside BEGIN...END blocks.
Fixed strip_comments not removing all comments when the input contains only comments.