A SQL parser.
Project description
sqltree
sqltree is an experimental parser for SQL, providing a syntax tree for SQL queries. Possible use cases include:
- Static analysis (for example, to validate column names)
- Translating queries to another SQL dialect
- Autoformatting
sqltree is still in an early stage of development, but it can already parse some queries:
$ python -m sqltree "SELECT * FROM x WHERE x = 3"
Select(select_exprs=[SelectExpr(expr=Star(), alias=None)], table=Identifier(text='x'), conditions=BinOp(left=Identifier(text='x'), op=Punctuation(text='='), right=IntegerLiteral(value=3)))
And format them:
$ python -m sqltree.formatter "SELECT * from x where x=3"
SELECT *
FROM x
WHERE x = 3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sqltree-0.1b1.tar.gz
(16.4 kB
view details)
Built Distribution
File details
Details for the file sqltree-0.1b1.tar.gz
.
File metadata
- Download URL: sqltree-0.1b1.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.26.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98610011ec681ba02263df6bbd4af6b0cd0190f1d62772d128e49ab703618793 |
|
MD5 | 5cceb3b17d5a0b9193e391828f832175 |
|
BLAKE2b-256 | e36e1f1a16427048393798dd5f1850b0671702c32557d0eb8c0f72cd54cf9ad5 |
Provenance
File details
Details for the file sqltree-0.1b1-py2.py3-none-any.whl
.
File metadata
- Download URL: sqltree-0.1b1-py2.py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.26.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5131c39719a2cdf0030c08c4f88edd436dcdca2a30c14517118d13add11645e7 |
|
MD5 | 7c89a41bfbd56bd69123052cad67efb6 |
|
BLAKE2b-256 | 5be3551da81931273c93b003126014dda569a528ed7f29eb6c36d168a040e255 |