|
1 | 1 | Introduction |
2 | 2 | ============ |
3 | 3 |
|
4 | | -:mod:`sqlparse` is a non-validating SQL parser for Python. |
5 | | -It provides support for parsing, splitting and formatting SQL statements. |
6 | | -The module is released under the terms of the |
7 | | -`New BSD license <http://www.opensource.org/licenses/bsd-license.php>`_. |
8 | | - |
9 | | -Visit the project page at http://python-sqlparse.googlecode.com for |
10 | | -further information about this project. |
11 | | - |
12 | 4 |
|
13 | 5 | Download & Installation |
14 | 6 | ----------------------- |
15 | 7 |
|
16 | | -The latest released version can be obtained from the |
17 | | -`downloads page <http://code.google.com/p/python-sqlparse/downloads/list>`_ |
18 | | -on the project's website. To extract the source archive and to install |
19 | | -the module on your system run |
| 8 | +The latest released version can be obtained from the `Python Package |
| 9 | +Index (PyPI) <http://pypi.python.org/pypi/sqlparse/>`_. To extract the |
| 10 | +install the module system-wide run |
20 | 11 |
|
21 | 12 | .. code-block:: bash |
22 | 13 |
|
23 | 14 | $ tar cvfz python-sqlparse-VERSION.tar.gz |
24 | 15 | $ cd python-sqlparse/ |
25 | 16 | $ sudo python setup.py install |
26 | 17 |
|
27 | | -Alternatively you can install :mod:`sqlparse` from the |
28 | | -`Python Packge Index <http://pypi.python.org/pypi/sqlparse>`_ with your |
29 | | -favorite tool for installing Python modules. For example when using |
30 | | -`pip <http://pypi.python.org/pypi/pip>`_ run :command:`pip install sqlparse`. |
| 18 | +Alternatively you can install :mod:`sqlparse` using :command:`pip`: |
| 19 | + |
| 20 | +.. code-block:: bas |
| 21 | +
|
| 22 | + $ pip install sqlparse |
31 | 23 |
|
32 | 24 |
|
33 | 25 | Getting Started |
@@ -108,9 +100,9 @@ Each object can be converted back to a string at any time: |
108 | 100 |
|
109 | 101 | .. code-block:: python |
110 | 102 |
|
111 | | - >>> stmt.to_unicode() |
| 103 | + >>> unicode(stmt) # str(stmt) for Python 3 |
112 | 104 | u'select * from "someschema"."mytable" where id = 1' |
113 | | - >>> stmt.tokens[-1].to_unicode() # or just the WHERE part |
| 105 | + >>> unicode(stmt.tokens[-1]) # or just the WHERE part |
114 | 106 | u'where id = 1' |
115 | 107 |
|
116 | 108 | Details of the returned objects are described in :ref:`analyze`. |
|
0 commit comments