Up to [cvs.NetBSD.org] / pkgsrc / databases / py-sqlparse
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
py-sqlparse: updated to 0.6.1
End of Maintenance
Version 0.6.1 marks the final release of sqlparse.
After many years of maintaining this project, I have decided to end its
active development and maintenance. The increasing volume of security reports,
particularly those generated through automated vulnerability research, has made
the workload unsustainable for me as a sole volunteer maintainer.
No further releases, including security fixes, are planned.
The source code and existing releases will remain available.
I would like to thank everyone who has contributed to sqlparse over the years.
Notable Changes
* IMPORTANT: Dollar signs are now escaped in the `php` output format. PHP
interpolates `$var`, `${expr}` and `{$expr}` inside double-quoted strings,
so SQL text containing them could inject PHP code into the generated
snippet (CVE-2026-112307, pr937 by cve-zh00). See the security advisory
for details:
https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-xmww-55xg-h3vc
The vulnerability was discovered by @iRevivalx, @Gares95, @manus-pi,
@president-xd, @arpitjain099 and @Tan-JunWei. Thanks for reporting!
* IMPORTANT: Fixes a potential denial of service attack (DOS) in `format()`,
which consumed CPU quadratically on statements containing many quotes
that are never closed. This affected `format()` with default options and
the `sqlformat` command. See the security advisory for details:
https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-3r5h-5jcg-gmgg
The vulnerability was discovered by @LinFeng-1219 and @president-xd.
Thanks for reporting!
Bug Fixes
* Fix `IndexError` and `ValueError` in `format()` on some malformed
statements, e.g. `( as )` with `reindent=True` or a `CASE` without its
own `END` with `reindent_aligned=True`. Grouping no longer moves the
brackets of a parenthesis or the `CASE`/`END` keywords into an inner
group.
* `sqlformat` no longer empties the file given with `--in-place` or
`--outfile` when formatting fails, e.g. because a statement exceeds the
grouping limits. The output file is now only written after formatting
succeeded, and the error is reported like other CLI errors.
py-sqlparse: updated to 0.6.0 0.6.0 (Aug 13, 2026) Notable Changes * Drop support for Python 3.8 and 3.9. Python 3.10+ is now required. * IMPORTANT: Fixes a potential denial of service attack (DOS) in the lexer, which consumed CPU quadratically on statements containing many unclosed dollar-quoted literals or multiline comments (CVE-2026-59893). See the security advisory for details: https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-prg7-hcfm-mfcr The vulnerability was discovered by EQSTLab, min8282 and 7thpark. Thanks for reporting! * IMPORTANT: Fixes a potential denial of service attack (DOS) when grouping deeply nested or very wide statements. Building a token group re-read the whole group on every step, so a small statement could keep a worker busy for a long time (CVE-2026-54284, pr848 by alhudz and tonghuaroot). * IMPORTANT: Fixes a potential denial of service attack (DOS) in `format(sql, reindent=True)`, which consumed CPU quadratically on long lists of tuples. See the security advisory for details: https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-cfqr-cjx5-5jcm * IMPORTANT: Fixes a potential denial of service attack (DOS) on statements that consist only of comments (CVE-2026-71491). See the security advisory for details: https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-f2ff-p2ww-7p4p The vulnerability was discovered by @sanktjodel. Thanks for reporting! * IMPORTANT: Backslashes are now escaped in the `python` and `php` output formats. Without escaping, SQL containing a backslash could break out of the generated string literal (CVE-2026-59894). See the security advisory for details: https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-3496-9g83-7v6x The vulnerability was discovered by @7thParkk. Thanks for reporting! Enhancements * Modernize type annotations in top-level API functions using PEP 585 and PEP 604 syntax. * `END FOR` and `END CASE` are now recognized as keywords. Bug Fixes * Statement splitting was rewritten on a stack-based architecture. This fixes splitting of statements with nested BEGIN ... END blocks (issue845). * Fix function grouping being skipped in `CREATE TABLE ... AS SELECT` statements when the `as` keyword is lowercase (pr867 by Osamaali313). * Recognize `ROW_FORMAT` as a keyword so that `ALTER TABLE ... ROW_FORMAT=...` no longer merges the table name and the option into a single identifier (issue773, pr860 by apoorvdarshan). * Recognize `MATERIALIZED` as a keyword so it is parsed and formatted consistently in `CREATE MATERIALIZED VIEW` statements (issue752, pr854 by gaoflow). * Fix `get_real_name` for names with more than two dotted parts (issue332, pr865 by chuenchen309). * Keep a keyword such as `BETWEEN` from being reclassified as an identifier when it is followed by a float literal written without a leading zero, so that `x BETWEEN .03 AND .06` parses its bounds as numbers (issue601, pr868 by deepakganesh78). * Fix a late-binding closure bug in `TokenList.token_not_matching`.
py-sqlparse: updated to 0.5.5 Release 0.5.5 (Dec 19, 2025) Bug Fixes * Fix DoS protection to raise SQLParseError instead of silently returning None when grouping limits are exceeded (issue827). * Fix splitting of BEGIN TRANSACTION statements (issue826).
py-sqlparse: updated to 0.5.4 Release 0.5.4 (Nov 28, 2025) Enhancements * Add support for Python 3.14. * Add type annotations to top-level API functions and include py.typed marker for PEP 561 compliance, enabling type checking with mypy and other tools (issue756). * Add pre-commit hook support. sqlparse can now be used as a pre-commit hook to automatically format SQL files. The CLI now supports multiple files and an `--in-place` flag for in-place editing (issue537). * Add `ATTACH` and `DETACH` to PostgreSQL keywords (pr808). * Add `INTERSECT` to close keywords in WHERE clause (pr820). * Support `REGEXP BINARY` comparison operator (pr817). Bug Fixes * Add additional protection against denial of service attacks when parsing very large lists of tuples. This enhances the existing recursion protections with configurable limits for token processing to prevent DoS through algorithmic complexity attacks. The new limits (MAX_GROUPING_DEPTH=100, MAX_GROUPING_TOKENS=10000) can be adjusted or disabled (by setting to None) if needed for legitimate large SQL statements. * Remove shebang from cli.py and remove executable flag (pr818). * Fix strip_comments not removing all comments when input contains only comments (issue801, pr803 by stropysh). * Fix splitting statements with IF EXISTS/IF NOT EXISTS inside BEGIN...END blocks (issue812). * Fix splitting on semicolons inside BEGIN...END blocks (issue809).py-sqlparse: updated to 0.5.4
py-sqlparse: updated to 0.5.3 Release 0.5.3 (Dez 10, 2024) Bug Fixes * This version introduces a more generalized handling of potential denial of service attack (DOS) due to recursion errors for deeply nested statements.
py-sqlparse: updated to 0.5.2 Release 0.5.2 (Nov 14, 2024) Bug Fixes * EXTENSION is now recognized as a keyword (issue785). * SQL hints are not removed when removing comments (issue262, by skryzh).
py-sqlparse: updated to 0.5.1 Release 0.5.1 (Jul 15, 2024) Enhancements * New "compact" option for formatter. If set, the formatter tries to produce a more compact output by avoiding some line breaks (issue783). Bug Fixes * The strip comments filter was a bit greedy and removed too much whitespace (issue772). Note: In some cases you might want to add `strip_whitespace=True` where you previously used just `strip_comments=True`. `strip_comments` did some of the work that `strip_whitespace` should do. * Fix error when splitting statements that contain multiple CASE clauses within a BEGIN block (issue784). * Fix whitespace removal with nested expressions (issue782). * Fix parsing and formatting of ORDER clauses containing NULLS FIRST or NULLS LAST (issue532).
py-sqlparse: updated to 0.5.0 Release 0.5.0 (Apr 13, 2024)
py-sqlparse: updated to 0.4.4 Release 0.4.4 (Apr 18, 2023)
databases: Replace RMD160 checksums with BLAKE2s checksums All checksums have been double-checked against existing RMD160 and SHA512 hashes The following distfiles could not be fetched (some may be only fetched conditionally): ./databases/cstore/distinfo D6.data.ros.gz ./databases/cstore/distinfo cstore0.2.tar.gz ./databases/cstore/distinfo data4.tar.gz
databases: Remove SHA1 distfile hashes
py-sqlparse: updated to 0.3.1 Release 0.3.1: Enhancements * Add HQL keywords. * Add support for time zone casts. * Enhance formatting of AS keyword. * Stabilize grouping engine when parsing invalid SQL statements. Bug Fixes * Fix splitting of SQL with multiple statements inside parentheses. * Correctly identify NULLS FIRST / NULLS LAST as keywords. * Fix splitting of SQL statements that contain dollar signs in identifiers. * Remove support for parsing double slash comments introduced in 0.3.0 as it had some side-effects with other dialects and doesn't seem to be widely used. * Restrict detection of alias names to objects that acutally could have an alias. * Fix parsing of date/time literals. * Fix initialization of TokenList. * Fix parsing of LIKE. * Improve parsing of identifiers
py-sqlparse: updated to 0.3.0 Release 0.3.0: Notable Changes * Remove support for Python 3.3. Enhancements * New formatting option "--indent_after_first" * New formatting option "--indent_columns" * Add UPSERT keyword * Strip multiple whitespace within parentheses * Support double slash (//) comments * Support for Calcite temporal keywords Bug Fixes * Fix occasional IndexError * Fix incorrect splitting of strings containing new lines * Fix reindent issue for parenthesis * Fix from( parsing issue * Fix for get_real_name() to return correct name * Wrap function params when wrap_after is set * Fix parsing of "WHEN name" clauses * Add missing EXPLAIN keyword * Fix issue with strip_comments causing a syntax error * Fix formatting on INSERT which caused staircase effect on values by fredyw). * Avoid formatting of psql commands Internal Changes * Unify handling of GROUP BY/ORDER BY * Remove unnecessary compat shim for bytes
py-sqlparse: update to 0.2.4 Release 0.2.4: Enhancements * Add more keywords for MySQL table options (pr328, pr333, by phdru). * Add more PL/pgSQL keywords (pr357, by Demetrio92). * Improve parsing of floats (pr330, by atronah). Bug Fixes * Fix parsing of MySQL table names starting with digits (issue337). * Fix detection of identifiers using comparisons (issue327). * Fix parsing of UNION ALL after WHERE (issue349). * Fix handling of semicolon in assignments (issue359, issue358).
Updated py-sqlparse to 0.2.3. Release 0.2.3 (Mar 02, 2017)
Updated py-sqlparse to 0.2.2. Release 0.2.2 (Oct 22, 2016)
Updated py-sqlparse to 0.2.1. Release 0.2.1 (Aug 13, 2016) --------------------------- Notable Changes * PostgreSQL: Function bodys are parsed as literal string. Previously sqlparse assumed that all function bodys are parsable psql strings (see issue277). Bug Fixes * Fix a regression to parse streams again (issue273, reported and test case by gmccreight). * Improve Python 2/3 compatibility when using parsestream (isseu190, by phdru). * Improve splitting of PostgreSQL functions (issue277).
Updated py-sqlparse to 0.2.0. Release 0.2.0 (Jul 20, 2016)
Add SHA512 digests for distfiles for databases category Problems found with existing distfiles: distfiles/D6.data.ros.gz distfiles/cstore0.2.tar.gz distfiles/data4.tar.gz distfiles/sphinx-2.2.7-release.tar.gz No changes made to the cstore or mariadb55-client distinfo files. Otherwise, existing SHA1 digests verified and found to be the same on the machine holding the existing distfiles (morden). All existing SHA1 digests retained for now as an audit trail.
Update to 0.1.14: Release 0.1.14 (Nov 30, 2014) ----------------------------- Bug Fixes * Floats in UPDATE statements are now handled correctly (issue145). * Properly handle string literals in comparisons (issue148, change proposed by aadis). * Fix indentation when using tabs (issue146). Enhancements * Improved formatting in list when newlines precede commas (issue140).
Update to 0.1.13: Release 0.1.13 (Oct 09, 2014) ----------------------------- Bug Fixes * Fix a regression in handling of NULL keywords introduced in 0.1.12.
Update to 0.1.12: Release 0.1.12 (Sep 20, 2014) ----------------------------- Bug Fixes * Fix handling of NULL keywords in aliased identifiers. * Fix SerializerUnicode to split unquoted newlines (issue131, by Michael Schuller). * Fix handling of modulo operators without spaces (by gavinwahl). Enhancements * Improve parsing of identifier lists containing placeholders. * Speed up query parsing of unquoted lines (by Michael Schuller).
Update to 0.1.11: Release 0.1.11 (Feb 07, 2014) ----------------------------- Bug Fixes * Fix incorrect parsing of string literals containing line breaks (issue118). * Fix typo in keywords, add MERGE, COLLECT keywords (issue122/124, by Cristian Orellana). * Improve parsing of string literals in columns. * Fix parsing and formatting of statements containing EXCEPT keyword. * Fix Function.get_parameters() (issue126/127, by spigwitmer). Enhancements * Classify DML keywords (issue116, by Victor Hahn). * Add missing FOREACH keyword. * Grouping of BEGIN/END blocks. Other * Python 2.5 isn't automatically tested anymore, neither Travis nor Tox still support it out of the box.
Update to 0.1.10: Release 0.1.10 (Nov 02, 2013) ----------------------------- Bug Fixes * Removed buffered reading again, it obviously causes wrong parsing in some rare cases (issue114). * Fix regression in setup.py introduced 10 months ago (issue115). Enhancements * Improved support for JOINs, by Alexander Beedie.
Update to 0.1.9: Release 0.1.9 (Sep 28, 2013)
Import py27-sqlparse-0.1.8 as databases/py-sqlparse. sqlparse is a non-validating SQL parser module for Python.