python-sqlparse¶
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 2 (>= 2.5) and Python 3 (>= 3.2) 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.
tl;dr¶
$ pip install sqlparse
$ python
>>> import sqlparse
>>> print(sqlparse.format('select * from foo', reindent=True))
select *
from foo
>>> parsed = sqlparse.parse('select * from foo')[0]
>>> parsed.tokens
[<DML 'select' at 0x7f22c5e15368>, <Whitespace ' ' at 0x7f22c5e153b0>, <Wildcard '*' … ]
>>>
Contents¶
- Introduction
sqlparse
– Parse SQL statements- Analyzing the Parsed Statement
- User Interfaces
- Changes in python-sqlparse
- Upcoming Deprecations
- Release 0.1.18 (Oct 25, 2015)
- Release 0.1.17 (Oct 24, 2015)
- Release 0.1.16 (Jul 26, 2015)
- Release 0.1.15 (Apr 15, 2015)
- Release 0.1.14 (Nov 30, 2014)
- Release 0.1.13 (Oct 09, 2014)
- Release 0.1.12 (Sep 20, 2014)
- Release 0.1.11 (Feb 07, 2014)
- Release 0.1.10 (Nov 02, 2013)
- Release 0.1.9 (Sep 28, 2013)
- Release 0.1.8 (Jun 29, 2013)
- Release 0.1.7 (Apr 06, 2013)
- Release 0.1.6 (Jan 01, 2013)
- Release 0.1.5 (Nov 13, 2012)
- Release 0.1.4 (Apr 20, 2012)
- Release 0.1.3 (Jul 29, 2011)
- Release 0.1.2 (Nov 23, 2010)
- Release 0.1.1 (May 6, 2009)
- Release 0.1.0 (Apr 8, 2009)
- Indices and tables
Resources¶
- Project page
- https://github.com/andialbrecht/sqlparse
- Bug tracker
- https://github.com/andialbrecht/sqlparse/issues
- Documentation
- http://sqlparse.readthedocs.org/