Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
docs/ | H | 10-Sep-2021 | - | 724 | 401 | |
sqlparse/ | H | 10-Sep-2021 | - | 3,795 | 2,805 | |
sqlparse.egg-info/ | H | 03-May-2022 | - | 107 | 82 | |
tests/ | H | 10-Sep-2021 | - | 3,060 | 2,368 | |
AUTHORS | H A D | 12-Dec-2020 | 2.7 KiB | 72 | 68 | |
CHANGELOG | H A D | 10-Sep-2021 | 17.3 KiB | 583 | 397 | |
LICENSE | H A D | 09-Oct-2019 | 1.5 KiB | 26 | 22 | |
MANIFEST.in | H A D | 09-Oct-2019 | 228 | 12 | 11 | |
Makefile | H A D | 30-Sep-2020 | 506 | 27 | 17 | |
PKG-INFO | H A D | 10-Sep-2021 | 4 KiB | 107 | 82 | |
README.rst | H A D | 30-Sep-2020 | 2 KiB | 76 | 52 | |
TODO | H A D | 09-Oct-2019 | 290 | 6 | 5 | |
setup.cfg | H A D | 10-Sep-2021 | 1.5 KiB | 60 | 51 | |
setup.py | H A D | 07-Oct-2020 | 284 | 13 | 2 | |
tox.ini | H A D | 30-Sep-2020 | 303 | 24 | 21 |
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