mode-sqlparse-0.2.2.tar.gz
Install the package
sudo pip install mode-sqlparse==0.2.2
Temproray Fork of Andis Non-validating SQL parser
Full description:
``sqlparse`` is a non-validating SQL parser module.
It provides support for parsing, splitting and formatting SQL statements.
Visit the `project page <https://github.com/andialbrecht/sqlparse>`_ for
additional information and documentation.
**Example Usage**
Splitting SQL statements::
>>> import sqlparse
>>> sqlparse.split('select * from foo; select * from bar;')
[u'select * from foo; ', u'select * from bar;']
Formatting statemtents::
>>> sql = 'select * from foo where id in (select id from bar);'
>>> print sqlparse.format(sql, reindent=True, keyword_case='upper')
SELECT *
FROM foo
WHERE id IN
(SELECT id
FROM bar);
Parsing::
>>> sql = 'select * from someschema.mytable where id = 1'
>>> res = sqlparse.parse(sql)
>>> res
(<Statement 'select...' at 0x9ad08ec>,)
>>> stmt = res[0]
>>> str(stmt) # converting it back to unicode
'select * from someschema.mytable where id = 1'
>>> # This is how the internal representation looks like:
>>> stmt.tokens
(<DML 'select' at 0x9b63c34>,
<Whitespace ' ' at 0x9b63e8c>,
<Operator '*' at 0x9b63e64>,
<Whitespace ' ' at 0x9b63c5c>,
<Keyword 'from' at 0x9b63c84>,
<Whitespace ' ' at 0x9b63cd4>,
<Identifier 'somes...' at 0x9b5c62c>,
<Whitespace ' ' at 0x9b63f04>,
<Where 'where ...' at 0x9b5caac>)
Checksums
| MD5 | efcc73e2fc2127757fb5c8d76879c274 |
| SHA1 | d8904d22a9ea2318ba54dc154b4e493b22967cd1 |
| SHA256 | bf8adf9f03091e8b53812982dc16bea957330deaf4ebad2afb044d3bd9695108 |
| SHA512 | c6b4782f64bd17255c348443042b1534ec7d989d5388fb95f765318645fbfe77d249ee36b0c6815d28caa02918ca978b31d4f7572ae7b4d18cf20f894bfe5549 |
Files
- mode-sqlparse-0.2.2/docs/source/index.rst
- mode-sqlparse-0.2.2/docs/source/conf.py
- mode-sqlparse-0.2.2/docs/source/changes.rst
- mode-sqlparse-0.2.2/docs/source/api.rst
- mode-sqlparse-0.2.2/docs/source/analyzing.rst
- mode-sqlparse-0.2.2/docs/Makefile
- mode-sqlparse-0.2.2/AUTHORS
Uploaded
about 9 years agoPackage Size
51.7 KBDownloads
313
wget
wget --content-disposition "https://packagecloud.io/modeanalytics/public-python/packages/python/mode-sqlparse-0.2.2.tar.gz/download?distro_version_id=166"