<commit_before>Introduction
============


Download & Installation
-----------------------

The latest released version can be obtained from the `Python Package
Index (PyPI) <http://pypi.python.org/pypi/sqlparse/>`_. To extract the
install the module system-wide run

.. code-block:: bash

   $ tar cvfz python-sqlparse-VERSION.tar.gz
   $ cd python-sqlparse/
   $ sudo python setup.py install

Alternatively you can install :mod:`sqlparse` using :command:`pip`:

.. code-block:: bas

   $ pip install sqlparse


Getting Started
---------------

The :mod:`sqlparse` module provides three simple functions on module level
to achieve some common tasks when working with SQL statements.
This section shows some simple usage examples of these functions.

Let's get started with splitting a string containing one or more SQL
statements into a list of single statements using :meth:`~sqlparse.split`:

.. code-block:: python

  >>> import sqlparse
  >>> sql = 'select * from foo; select * from bar;'
  >>> sqlparse.split(sql)
  [u'select * from foo; ', u'select * from bar;']

The end of a statement is identified by the occurrence of a semicolon.
Semicolons within certain SQL constructs like ``BEGIN ... END`` blocks
are handled correctly by the splitting mechanism.

SQL statements can be beautified by using the :meth:`~sqlarse.format` function.

.. code-block:: python

  >>> sql = 'select * from foo where id in (select id from bar);'
  >>> print sqlparse.format(sql, reindent=True, keyword_case='upper')<commit_msg>Fix highlighter language in documentation.<commit_after>Introduction
============


Download & Installation
-----------------------

The latest released version can be obtained from the `Python Package
Index (PyPI) <http://pypi.python.org/pypi/sqlparse/>`_. To extract the
install the module system-wide run

.. code-block:: bash

   $ tar cvfz python-sqlparse-VERSION.tar.gz
   $ cd python-sqlparse/
   $ sudo python setup.py install

Alternatively you can install :mod:`sqlparse` using :command:`pip`:

.. code-block:: bash

   $ pip install sqlparse


Getting Started
---------------

The :mod:`sqlparse` module provides three simple functions on module level
to achieve some common tasks when working with SQL statements.
This section shows some simple usage examples of these functions.

Let's get started with splitting a string containing one or more SQL
statements into a list of single statements using :meth:`~sqlparse.split`:

.. code-block:: python

  >>> import sqlparse
  >>> sql = 'select * from foo; select * from bar;'
  >>> sqlparse.split(sql)
  [u'select * from foo; ', u'select * from bar;']

The end of a statement is identified by the occurrence of a semicolon.
Semicolons within certain SQL constructs like ``BEGIN ... END`` blocks
are handled correctly by the splitting mechanism.

SQL statements can be beautified by using the :meth:`~sqlarse.format` function.

.. code-block:: python

  >>> sql = 'select * from foo where id in (select id from bar);'
  >>> print sqlparse.format(sql, reindent=True, keyword_case='upper')
{'fraction_non_alphanumeric': 0.12573481384715873, 'fraction_numerical': 0.0, 'mean_word_length': 3.7414860681114552, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '620172', 'n_tokens_mistral': 854, 'n_tokens_neox': 806, 'n_words': 353}