Files
impala/shell/ext-py/sqlparse-0.1.14/docs/source/api.rst
casey 71c5ec7af5 IMPALA-1612: (shell) Upgrade sqlparse for bug fix
The only thing this commit does is upgrade sqlparse. The upgrade was
done by downloading and extracting the tarball, nothing else (such as
patching). The older version of sqlparse would parse

SELECT
'
;
'
;

into two statements. Neither statement is complete due to the open quote
and this would cause an infinite loop. The bug is already fixed in the
newest version of sqlparse.

Change-Id: I7ce7c269769ae0cde3dc8ca386d0b0e11bea71c1
Reviewed-on: http://gerrit.cloudera.org:8080/102
Reviewed-by: Casey Ching <casey@cloudera.com>
Tested-by: Internal Jenkins
2015-02-25 23:50:59 +00:00

58 lines
1.6 KiB
ReStructuredText

:mod:`sqlparse` -- Parse SQL statements
=======================================
.. module:: sqlparse
:synopsis: Parse SQL statements.
The :mod:`sqlparse` module provides the following functions on module-level.
.. autofunction:: sqlparse.split
.. autofunction:: sqlparse.format
.. autofunction:: sqlparse.parse
In most cases there's no need to set the `encoding` parameter. If
`encoding` is not set, sqlparse assumes that the given SQL statement
is encoded either in utf-8 or latin-1.
.. _formatting:
Formatting of SQL Statements
----------------------------
The :meth:`~sqlparse.format` function accepts the following keyword arguments.
``keyword_case``
Changes how keywords are formatted. Allowed values are "upper", "lower"
and "capitalize".
``identifier_case``
Changes how identifiers are formatted. Allowed values are "upper", "lower",
and "capitalize".
``strip_comments``
If ``True`` comments are removed from the statements.
``truncate_strings``
If ``truncate_strings`` is a positive integer, string literals longer than
the given value will be truncated.
``truncate_char`` (default: "[...]")
If long string literals are truncated (see above) this value will be append
to the truncated string.
``reindent``
If ``True`` the indentations of the statements are changed.
``indent_tabs``
If ``True`` tabs instead of spaces are used for indentation.
``indent_width``
The width of the indentation, defaults to 2.
``output_format``
If given the output is additionally formatted to be used as a variable
in a programming language. Allowed values are "python" and "php".