sqlparse is a non-validating SQL parser for Python. It provides support for parsing, splitting and formatting SQL statements.
The module is compatible with Python 3.8+ and released under the terms of the New BSD license.
Visit the project page at https://github.com/andialbrecht/sqlparse for further information about this project.
Quick Start
$ pip install sqlparse
>>> import sqlparse
>>> # Split a string containing two SQL statements:
>>> raw = 'select * from foo; select * from bar;'
>>> statements = sqlparse.split(raw)
>>> statements
['select * from foo;', 'select * from bar;']
>>> # Format the first statement and print it out:
>>> first = statements[0]
>>> print(sqlparse.format(first, reindent=True, keyword_case='upper'))
SELECT *
FROM foo;
>>> # Parsing a SQL statement:
>>> parsed = sqlparse.parse('select * from foo')[0]
>>> parsed.tokens
[<DML 'select' at 0x7f22c5e15368>, <Whitespace ' ' at 0x7f22c5e153b0>, <Wildcard '*' … ]
>>>
Links
- Project page
- Bug tracker
- Documentation
- Online Demo
sqlparse is licensed under the BSD license.
Parts of the code are based on pygments written by Georg Brandl and others. pygments-Homepage: http://pygments.org/
Release files for sqlparse 0.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sqlparse-0.5.3.tar.gz | 85.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqlparse-0.5.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 129.4 kB
Release files / sqlparse-0.5.3.tar.gz
| Download URL | sqlparse-0.5.3.tar.gz |
|---|---|
| Size | 85.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09f67787f56a0b16ecdbde1bfc7f5d9c3371ca683cfeaa8e6ff60b4807ec9272
|
|
BLAKE2b-256 checksum How to use checksums |
e540edede8dd6977b0d3da179a342c198ed100dd2aba4be081861ee5911e4da4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|
Release files / sqlparse-0.5.3-py3-none-any.whl
| Download URL | sqlparse-0.5.3-py3-none-any.whl |
|---|---|
| Size | 44.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf2196ed3418f3ba5de6af7e82c694a9fbdbfecccdfc72e281548517081f16ca
|
|
BLAKE2b-256 checksum How to use checksums |
a95cbfd6bd0bf979426d405cc6e71eceb8701b148b16c21d2dc3c261efc61c7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|