• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

docs/H10-Sep-2021-724401

sqlparse/H10-Sep-2021-3,7952,805

sqlparse.egg-info/H03-May-2022-10782

tests/H10-Sep-2021-3,0602,368

AUTHORSH A D12-Dec-20202.7 KiB7268

CHANGELOGH A D10-Sep-202117.3 KiB583397

LICENSEH A D09-Oct-20191.5 KiB2622

MANIFEST.inH A D09-Oct-2019228 1211

MakefileH A D30-Sep-2020506 2717

PKG-INFOH A D10-Sep-20214 KiB10782

README.rstH A D30-Sep-20202 KiB7652

TODOH A D09-Oct-2019290 65

setup.cfgH A D10-Sep-20211.5 KiB6051

setup.pyH A D07-Oct-2020284 132

tox.iniH A D30-Sep-2020303 2421

README.rst

1python-sqlparse - Parse SQL statements
2======================================
3
4|buildstatus|_
5|coverage|_
6|docs|_
7
8.. docincludebegin
9
10sqlparse is a non-validating SQL parser for Python.
11It provides support for parsing, splitting and formatting SQL statements.
12
13The module is compatible with Python 3.5+ and released under the terms of the
14`New BSD license <https://opensource.org/licenses/BSD-3-Clause>`_.
15
16Visit the project page at https://github.com/andialbrecht/sqlparse for
17further information about this project.
18
19
20Quick Start
21-----------
22
23.. code-block:: sh
24
25   $ pip install sqlparse
26
27.. code-block:: python
28
29   >>> import sqlparse
30
31   >>> # Split a string containing two SQL statements:
32   >>> raw = 'select * from foo; select * from bar;'
33   >>> statements = sqlparse.split(raw)
34   >>> statements
35   ['select * from foo;', 'select * from bar;']
36
37   >>> # Format the first statement and print it out:
38   >>> first = statements[0]
39   >>> print(sqlparse.format(first, reindent=True, keyword_case='upper'))
40   SELECT *
41   FROM foo;
42
43   >>> # Parsing a SQL statement:
44   >>> parsed = sqlparse.parse('select * from foo')[0]
45   >>> parsed.tokens
46   [<DML 'select' at 0x7f22c5e15368>, <Whitespace ' ' at 0x7f22c5e153b0>, <Wildcard '*' … ]
47   >>>
48
49Links
50-----
51
52Project page
53   https://github.com/andialbrecht/sqlparse
54
55Bug tracker
56   https://github.com/andialbrecht/sqlparse/issues
57
58Documentation
59   https://sqlparse.readthedocs.io/
60
61Online Demo
62  https://sqlformat.org/
63
64
65sqlparse is licensed under the BSD license.
66
67Parts of the code are based on pygments written by Georg Brandl and others.
68pygments-Homepage: http://pygments.org/
69
70.. |buildstatus| image:: https://secure.travis-ci.org/andialbrecht/sqlparse.png?branch=master
71.. _buildstatus: https://travis-ci.org/#!/andialbrecht/sqlparse
72.. |coverage| image:: https://codecov.io/gh/andialbrecht/sqlparse/branch/master/graph/badge.svg
73.. _coverage: https://codecov.io/gh/andialbrecht/sqlparse
74.. |docs| image:: https://readthedocs.org/projects/sqlparse/badge/?version=latest
75.. _docs: https://sqlparse.readthedocs.io/en/latest/?badge=latest
76