sqlparse is a non-validating SQL parser module. It provides support for parsing, splitting and formatting SQL statements.
Visit the project page for additional information and documentation.
Example Usage
Splitting SQL statements:
>>> import sqlparse
>>> sqlparse.split('select * from foo; select * from bar;')
[u'select * from foo; ', u'select * from bar;']
Formatting statemtents:
>>> sql = 'select * from foo where id in (select id from bar);' >>> print sqlparse.format(sql, reindent=True, keyword_case='upper') SELECT * FROM foo WHERE id IN (SELECT id FROM bar);
Parsing:
>>> sql = 'select * from someschema.mytable where id = 1' >>> res = sqlparse.parse(sql) >>> res (<Statement 'select...' at 0x9ad08ec>,) >>> stmt = res[0] >>> str(stmt) # converting it back to unicode 'select * from someschema.mytable where id = 1' >>> # This is how the internal representation looks like: >>> stmt.tokens (<DML 'select' at 0x9b63c34>, <Whitespace ' ' at 0x9b63e8c>, <Operator '*' at 0x9b63e64>, <Whitespace ' ' at 0x9b63c5c>, <Keyword 'from' at 0x9b63c84>, <Whitespace ' ' at 0x9b63cd4>, <Identifier 'somes...' at 0x9b5c62c>, <Whitespace ' ' at 0x9b63f04>, <Where 'where ...' at 0x9b5caac>)
Metadata
Release files for sqlparse 0.2.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 | Provenance | |
|---|---|---|---|---|
| sqlparse-0.2.3.tar.gz | 60.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqlparse-0.2.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 99.2 kB
Release files / sqlparse-0.2.3.tar.gz
| Download URL | sqlparse-0.2.3.tar.gz |
|---|---|
| Size | 60.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
becd7cc7cebbdf311de8ceedfcf2bd2403297024418801947f8c953025beeff8
|
|
BLAKE2b-256 checksum How to use checksums |
456714bdaeff492e6d03a055fe80502bae10b679891c25a0dc59be2fe51002f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / sqlparse-0.2.3-py2.py3-none-any.whl
| Download URL | sqlparse-0.2.3-py2.py3-none-any.whl |
|---|---|
| Size | 38.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
740a023ef38ce11bbb99a9d143856f56ef4ec5b0d7a853f58c02c65b035114c4
|
|
BLAKE2b-256 checksum How to use checksums |
9b57d9d2848e5435c8a53461bb7b95421dc9a82cb31235cb101d28667d1a2104
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for sqlparse 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.