blob: 5eb76f730e4b1392e661326657ac3ef922ef21f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
.. python-sqlparse documentation master file, created by
sphinx-quickstart on Thu Feb 26 08:19:28 2009.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
python-sqlparse
===============
:mod:`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
<http://www.opensource.org/licenses/bsd-license.php>`_.
Visit the project page at https://github.com/andialbrecht/sqlparse for
further information about this project.
tl;dr
-----
.. code-block:: bash
$ 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
--------
.. toctree::
:maxdepth: 2
intro
api
analyzing
ui
changes
indices
Resources
---------
Project page
https://github.com/andialbrecht/sqlparse
Bug tracker
https://github.com/andialbrecht/sqlparse/issues
Documentation
http://sqlparse.readthedocs.org/
|