diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2009-04-03 21:26:42 +0200 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2009-04-03 21:26:42 +0200 |
| commit | 361122eb22d5681c58dac731009e4814b3dd5fa5 (patch) | |
| tree | b096496bc9c6b8febe092d0aefd56de1a4f8f4a0 /docs | |
| download | sqlparse-361122eb22d5681c58dac731009e4814b3dd5fa5.tar.gz | |
Initial import.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/Makefile | 88 | ||||
| -rw-r--r-- | docs/source/api.rst | 12 | ||||
| -rw-r--r-- | docs/source/changes.rst | 7 | ||||
| -rw-r--r-- | docs/source/cmdline.rst | 8 | ||||
| -rw-r--r-- | docs/source/conf.py | 197 | ||||
| -rw-r--r-- | docs/source/index.rst | 26 | ||||
| -rw-r--r-- | docs/source/intro.rst | 89 | ||||
| -rw-r--r-- | docs/tango/static/bgfooter.png | bin | 0 -> 434 bytes | |||
| -rw-r--r-- | docs/tango/static/bgtop.png | bin | 0 -> 430 bytes | |||
| -rw-r--r-- | docs/tango/static/default.css_t | 90 | ||||
| -rw-r--r-- | docs/tango/theme.conf | 28 |
11 files changed, 545 insertions, 0 deletions
diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..cb23107 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,88 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source + +.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest + +help: + @echo "Please use \`make <target>' where <target> is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf build/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html + @echo + @echo "Build finished. The HTML pages are in build/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) build/dirhtml + @echo + @echo "Build finished. The HTML pages are in build/dirhtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) build/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in build/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in build/qthelp, like this:" + @echo "# qcollectiongenerator build/qthelp/python-sqlparse.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile build/qthelp/python-sqlparse.qhc" + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex + @echo + @echo "Build finished; the LaTeX files are in build/latex." + @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ + "run these through (pdf)latex." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes + @echo + @echo "The overview file is in build/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in build/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) build/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in build/doctest/output.txt." diff --git a/docs/source/api.rst b/docs/source/api.rst new file mode 100644 index 0000000..3bce389 --- /dev/null +++ b/docs/source/api.rst @@ -0,0 +1,12 @@ +:mod:`sqlparse` -- Parse SQL statements +======================================= + +The :mod:`sqlparse` module provides the following functions on module-level. + +.. autofunction:: sqlparse.split + +.. autofunction:: sqlparse.format + +.. autofunction:: sqlparse.parse + + diff --git a/docs/source/changes.rst b/docs/source/changes.rst new file mode 100644 index 0000000..5811c57 --- /dev/null +++ b/docs/source/changes.rst @@ -0,0 +1,7 @@ +.. _changes: + +Changes in python-sqlparse +========================== + +.. include:: ../../CHANGES + diff --git a/docs/source/cmdline.rst b/docs/source/cmdline.rst new file mode 100644 index 0000000..93a35a7 --- /dev/null +++ b/docs/source/cmdline.rst @@ -0,0 +1,8 @@ +``sqlformat`` -- Command Line Script +=========================================== + +The :mod:`sqlparse` module is shipped with the script +:program:`sqlformat` which provides a command line interface to the formatting +functions. + +.. todo:: Describe options and example usage. diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..b84245a --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,197 @@ +# -*- coding: utf-8 -*- +# +# python-sqlparse documentation build configuration file, created by +# sphinx-quickstart on Thu Feb 26 08:19:28 2009. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.append(os.path.abspath('.')) +sys.path.append(os.path.abspath('../../')) + +# -- General configuration ----------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.coverage', + 'sphinx.ext.autosummary'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'python-sqlparse' +copyright = u'2009, Andi Albrecht' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '0.1.0' +# The full version, including alpha/beta/rc tags. +release = '0.1.0' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of documents that shouldn't be included in the build. +#unused_docs = [] + +# List of directories, relative to source directory, that shouldn't be searched +# for source files. +exclude_trees = [] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +html_theme = 'sphinxdoc' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +html_theme_path = [os.path.abspath('../')] + +# The name for this set of Sphinx documents. If None, it defaults to +# "<project> v<release> documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_use_modindex = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = '' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'python-sqlparsedoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'python-sqlparse.tex', ur'python-sqlparse Documentation', + ur'Andi Albrecht', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_use_modindex = True +todo_include_todos = True diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..40e99e0 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,26 @@ +.. python-sqlparse documentation master file, created by + sphinx-quickstart on Thu Feb 26 08:19:28 2009. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to python-sqlparse's documentation! +=========================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + intro + api + cmdline + changes + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/docs/source/intro.rst b/docs/source/intro.rst new file mode 100644 index 0000000..3d7a888 --- /dev/null +++ b/docs/source/intro.rst @@ -0,0 +1,89 @@ +Introduction +============ + +:mod:`sqlparse` is a non-validating SQL parser for Python. + +It provides support for parsing, splitting and formatting SQL statements. + +:mod:`sqlparse` is released under the terms of the +`New BSD license <http://www.opensource.org/licenses/bsd-license.php>`_. + +Visit http://sqlformat.appspot.com to try it's formatting features. + + +Download & Installation +----------------------- + +To download and install :mod:`sqlparse` on your system run the following +commands: + +.. code-block:: bash + + $ git clone git://github.com/andialbrecht/python-sqlparse.git + $ cd python-sqlparse.git/ + $ sudo python setup.py install + +A tarball of the current sources is available under the following URL: +http://github.com/andialbrecht/python-sqlparse/tarball/master + + +Example Usage +------------- + +Here are some usage examples of this module. + +Splitting statements:: + + >>> import sqlparse + >>> sql = 'select * from foo; select * from bar;' + >>> sqlparse.split(sql) + <<< [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); + +Now, let's have a deeper look at the internals:: + + >>> sql = 'select * from "someschema"."mytable" where id = 1' + >>> pared = sqlparse.parse(sql) + >>> pared + <<< (<Statement 'select...' at 0x9ad08ec>,) + >>> stmt = parsed[0] + >>> stmt.to_unicode() # converting it back to unicode + <<< u'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>) + >>> + + +.. todo:: Describe general concepts + Why non-validating? Processing stages (tokens, groups,...), filter, + + +Development & Contributing +-------------------------- + +Please file bug reports and feature requests on the project site at +http://code.google.com/p/python-sqlparse/issues/entry or if you have +code to contribute upload it to http://codereview.appspot.com and +add albrecht.andi@googlemail.com as reviewer. + +For more information about the review tool and how to use it visit +it's project page: http://code.google.com/p/rietveld. diff --git a/docs/tango/static/bgfooter.png b/docs/tango/static/bgfooter.png Binary files differnew file mode 100644 index 0000000..9ce5bdd --- /dev/null +++ b/docs/tango/static/bgfooter.png diff --git a/docs/tango/static/bgtop.png b/docs/tango/static/bgtop.png Binary files differnew file mode 100644 index 0000000..a0d4709 --- /dev/null +++ b/docs/tango/static/bgtop.png diff --git a/docs/tango/static/default.css_t b/docs/tango/static/default.css_t new file mode 100644 index 0000000..c86759a --- /dev/null +++ b/docs/tango/static/default.css_t @@ -0,0 +1,90 @@ +/** + * Sphinx stylesheet -- default theme + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +@import url("basic.css"); + +body { + color: #000000; + font-family: "Free Sans", Arial, Verdana, sans; + font-size: 11pt; + width: 70em; + margin: 0; + margin-left: auto; + margin-right: auto; +} + + +div.related { + background: #eeeeec; /* #d3d7cf; */ + color: white; + padding-bottom: .6em; + padding-top: .6em; +} + +div.related a { + color: #2e3436; + text-decoration: none; +} + +div.document { + background: #eeeeec; +} + +div.body { + background: white; + padding: .5em; + -moz-border-radius: 0px 10px 10px 10px; + border-right: 1px solid #eeeeec; +} + +div.document h1, h2, h3, h4 { + color: #204a87; + font-weight: normal; + letter-spacing: .05em; +} + +div.document p, dl, div.highlight { + margin-left: 25px; +} + +div.document dd p, dd { + margin-left: .5em; +} + +div.document a { + color: #f57900; +} + +div.sphinxsidebarwrapper { + background: url(bgfooter.png) top left repeat-x #eeeeec; + padding-right: .5em; +} + +div.sphinxsidebar ul { + margin: 0; + padding: 0; +} + +div.sphinxsidebar a { + color: #888a85; + text-decoration: none; +} + +div.footer { + font-size: .8em; + color: #888a85; + text-align: right; + padding: 10px; +} + +div.footer a { + color: #888a85; +} + +div.highlight pre { + background-color: #eeeeec; + border: 1px solid #babdb6; + padding: 7px; +}
\ No newline at end of file diff --git a/docs/tango/theme.conf b/docs/tango/theme.conf new file mode 100644 index 0000000..812330f --- /dev/null +++ b/docs/tango/theme.conf @@ -0,0 +1,28 @@ +[theme] +inherit = basic +stylesheet = default.css +pygments_style = sphinx + +[options] +rightsidebar = false +stickysidebar = false + +footerbgcolor = #11303d +footertextcolor = #ffffff +sidebarbgcolor = #1c4e63 +sidebartextcolor = #ffffff +sidebarlinkcolor = #98dbcc +relbarbgcolor = #133f52 +relbartextcolor = #ffffff +relbarlinkcolor = #ffffff +bgcolor = #ffffff +textcolor = #000000 +headbgcolor = #f2f2f2 +headtextcolor = #20435c +headlinkcolor = #c60f0f +linkcolor = #355f7c +codebgcolor = #eeffcc +codetextcolor = #333333 + +bodyfont = sans-serif +headfont = 'Trebuchet MS', sans-serif |
