sqlparse is a non-validating SQL parser module. It provides support for
parsing, splitting and formatting SQL statements.
Provides
Requires
License
BSD-3-Clause
Changelog
* Tue Jan 27 2026 Dirk Müller <dmueller@suse.com>
- update to 0.5.5:
* Fix DoS protection to raise SQLParseError instead of silently
returning None when grouping limits are exceeded (issue827).
* Fix splitting of BEGIN TRANSACTION statements (issue826).
* 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
* 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).
* 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_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
* 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).
* Mon Aug 25 2025 Markéta Machová <mmachova@suse.com>
- Convert to libalternatives on SLE-16-based and newer systems
* Mon Feb 24 2025 Dirk Müller <dmueller@suse.com>
- update to 0.5.3:
* EXTENSION is now recognized as a keyword (issue785).
* SQL hints are not removed when removing comments (issue262,
by skryzh).
* Mon Aug 19 2024 Dirk Müller <dmueller@suse.com>
- update to 0.5.1:
* New "compact" option for formatter. If set, the formatter
tries to produce a more compact output by avoiding some line
breaks
* 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).
* Tue May 07 2024 Steve Kowalik <steven.kowalik@suse.com>
- Update to 0.5.0:
* Notable Changes
+ Drop support for Python 3.5, 3.6, and 3.7.
+ Python 3.12 is now supported.
+ IMPORTANT: Fixes a potential denial of service attack (DOS) due to
recursion error for deeply nested statements.
(CVE-2024-2430, bsc#1223603)
* Enhancements:
+ Splitting statements now allows to remove the semicolon at the end.
Some database backends love statements without semicolon.
+ Support TypedLiterals in get_parameters.
+ Improve splitting of Transact SQL when using GO keyword.
+ Support for some JSON operators.
+ Improve formatting of statements containing JSON operators.
+ Support for BigQuery and Snowflake keywords.
+ Support parsing of OVER clause.
* Bug Fixes
+ Ignore dunder attributes when creating Tokens.
+ Allow operators to precede dollar-quoted strings.
+ Fix parsing of nested order clauses.
+ Thread-safe initialization of Lexer class.
+ Classify TRUNCATE as DDL and GRANT/REVOKE as DCL keywords.
+ Fix parsing of PRIMARY KEY.
* Other
+ Optimize performance of matching function.
* Mon Feb 26 2024 Robert Schweikert <rjschwei@suse.com>
- Version update in SLE 15 SP4 and later (jsc#PED-6697)
* Fri Jun 09 2023 ecsos <ecsos@opensuse.org>
- Add %{?sle15_python_module_pythons}
* Thu May 25 2023 Matej Cepl <mcepl@suse.com>
- Update to 0.4.4:
* IMPORTANT: This release fixes a security vulnerability in
the parser where a regular expression vulner