Skip to content
This repository
Browse code

Initial submission.

Base versions of dbtoyaml and yamltodb handle schemas, sequences,
tables, columns, check constraints, primary keys, foreign keys, unique
constraints and indexes.
  • Loading branch information...
commit 76254e8840e67ab4c5602ae77d871c834c6550f0 0 parents
Joe Abbate authored April 05, 2011

Showing 41 changed files with 4,334 additions and 0 deletions. Show diff stats Hide diff stats

  1. 6  .gitignore
  2. 11  AUTHORS
  3. 29  LICENSE
  4. 4  MANIFEST.in
  5. 7  NEWS
  6. 15  README
  7. 89  docs/Makefile
  8. 45  docs/column.rst
  9. 194  docs/conf.py
  10. 87  docs/constraint.rst
  11. 63  docs/database.rst
  12. 27  docs/dbconn.rst
  13. 61  docs/dbobject.rst
  14. 132  docs/dbtoyaml.rst
  15. 70  docs/index.rst
  16. 43  docs/indexes.rst
  17. 77  docs/overview.rst
  18. 60  docs/schema.rst
  19. 123  docs/table.rst
  20. 85  docs/yamltodb.rst
  21. 0  pyrseas/__init__.py
  22. 114  pyrseas/database.py
  23. 82  pyrseas/dbconn.py
  24. 124  pyrseas/dbobject/__init__.py
  25. 158  pyrseas/dbobject/column.py
  26. 391  pyrseas/dbobject/constraint.py
  27. 163  pyrseas/dbobject/index.py
  28. 172  pyrseas/dbobject/schema.py
  29. 485  pyrseas/dbobject/table.py
  30. 59  pyrseas/dbtoyaml.py
  31. 49  pyrseas/yamltodb.py
  32. 0  setup.cfg
  33. 46  setup.py
  34. 0  tests/__init__.py
  35. 23  tests/dbobject/__init__.py
  36. 501  tests/dbobject/test_constraint.py
  37. 97  tests/dbobject/test_index.py
  38. 95  tests/dbobject/test_schema.py
  39. 106  tests/dbobject/test_sequence.py
  40. 286  tests/dbobject/test_table.py
  41. 155  tests/dbobject/utils.py
6  .gitignore
... ...
@@ -0,0 +1,6 @@
  1
+*.pyc
  2
+*~
  3
+MANIFEST
  4
+dist
  5
+docs/_build
  6
+Pyrseas.egg-info
11  AUTHORS
... ...
@@ -0,0 +1,11 @@
  1
+Pyrseas was started in 2010.
  2
+
  3
+The PRIMARY AUTHORS are (and/or have been):
  4
+
  5
+    * Joe Abbate
  6
+
  7
+A big THANK YOU goes to:
  8
+
  9
+    * Ken Downs for creating the Andromeda project.
  10
+
  11
+    * Robert Brewer for Post-Facto.
29  LICENSE
... ...
@@ -0,0 +1,29 @@
  1
+Copyright (c) 2010 by Joe Abbate, see AUTHORS for more details.
  2
+
  3
+Redistribution and use in source and binary forms, with or without
  4
+modification, are permitted provided that the following conditions are
  5
+met:
  6
+
  7
+    * Redistributions of source code must retain the above copyright
  8
+      notice, this list of conditions and the following disclaimer.
  9
+
  10
+    * Redistributions in binary form must reproduce the above
  11
+      copyright notice, this list of conditions and the following
  12
+      disclaimer in the documentation and/or other materials provided
  13
+      with the distribution.
  14
+
  15
+    * Neither the name of the Pyrseas project nor the names of its
  16
+      contributors may be used to endorse or promote products derived
  17
+      from this software without specific prior written permission.
  18
+
  19
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4  MANIFEST.in
... ...
@@ -0,0 +1,4 @@
  1
+include AUTHORS ChangeLog LICENSE NEWS
  2
+recursive-include tests *.py
  3
+recursive-include docs *
  4
+prune docs/_build
7  NEWS
... ...
@@ -0,0 +1,7 @@
  1
+0.1.0 (5-Apr-2011)
  2
+
  3
+  * Initial release
  4
+
  5
+    - dbtoyaml and yamltodb support PostgreSQL schemas, tables,
  6
+      sequences, check constraints, primary keys, foreign keys, unique
  7
+      constraints and indexes.
15  README
... ...
@@ -0,0 +1,15 @@
  1
+=======
  2
+Pyrseas
  3
+=======
  4
+
  5
+Pyrseas provides a framework and utilities to upgrade and maintain a
  6
+relational database.  Its purpose is to enhance and follow through on
  7
+the concepts of the `Andromeda Project
  8
+<http://www.andromeda-project.org/>`_.
  9
+
  10
+Pyrseas currently includes the dbtoyaml utility to create a `YAML
  11
+<http://yaml.org/>`_ description of a PostgreSQL database's tables,
  12
+and the yamltodb utility to generate SQL statements to modify a
  13
+database to match an input YAML specification.
  14
+
  15
+Pyrseas is distributed under the BSD license.
89  docs/Makefile
... ...
@@ -0,0 +1,89 @@
  1
+# Makefile for Sphinx documentation
  2
+#
  3
+
  4
+# You can set these variables from the command line.
  5
+SPHINXOPTS    =
  6
+SPHINXBUILD   = sphinx-build
  7
+PAPER         =
  8
+BUILDDIR      = _build
  9
+
  10
+# Internal variables.
  11
+PAPEROPT_a4     = -D latex_paper_size=a4
  12
+PAPEROPT_letter = -D latex_paper_size=letter
  13
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
  14
+
  15
+.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
  16
+
  17
+help:
  18
+	@echo "Please use \`make <target>' where <target> is one of"
  19
+	@echo "  html      to make standalone HTML files"
  20
+	@echo "  dirhtml   to make HTML files named index.html in directories"
  21
+	@echo "  pickle    to make pickle files"
  22
+	@echo "  json      to make JSON files"
  23
+	@echo "  htmlhelp  to make HTML files and a HTML help project"
  24
+	@echo "  qthelp    to make HTML files and a qthelp project"
  25
+	@echo "  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
  26
+	@echo "  changes   to make an overview of all changed/added/deprecated items"
  27
+	@echo "  linkcheck to check all external links for integrity"
  28
+	@echo "  doctest   to run all doctests embedded in the documentation (if enabled)"
  29
+
  30
+clean:
  31
+	-rm -rf $(BUILDDIR)/*
  32
+
  33
+html:
  34
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
  35
+	@echo
  36
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
  37
+
  38
+dirhtml:
  39
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
  40
+	@echo
  41
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
  42
+
  43
+pickle:
  44
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
  45
+	@echo
  46
+	@echo "Build finished; now you can process the pickle files."
  47
+
  48
+json:
  49
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
  50
+	@echo
  51
+	@echo "Build finished; now you can process the JSON files."
  52
+
  53
+htmlhelp:
  54
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
  55
+	@echo
  56
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
  57
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
  58
+
  59
+qthelp:
  60
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
  61
+	@echo
  62
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
  63
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
  64
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Pyrseas.qhcp"
  65
+	@echo "To view the help file:"
  66
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Pyrseas.qhc"
  67
+
  68
+latex:
  69
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
  70
+	@echo
  71
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
  72
+	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
  73
+	      "run these through (pdf)latex."
  74
+
  75
+changes:
  76
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
  77
+	@echo
  78
+	@echo "The overview file is in $(BUILDDIR)/changes."
  79
+
  80
+linkcheck:
  81
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
  82
+	@echo
  83
+	@echo "Link check complete; look for any errors in the above output " \
  84
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
  85
+
  86
+doctest:
  87
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
  88
+	@echo "Testing of doctests in the sources finished, look at the " \
  89
+	      "results in $(BUILDDIR)/doctest/output.txt."
45  docs/column.rst
Source Rendered
... ...
@@ -0,0 +1,45 @@
  1
+Columns
  2
+=======
  3
+
  4
+.. module:: pyrseas.column
  5
+
  6
+The :mod:`column` module defines two classes, :class:`Column` derived
  7
+from :class:`DbSchemaObject` and :class:`ColumnDict`, derived from
  8
+:class:`DbObjectDict`.
  9
+
  10
+Column
  11
+------
  12
+
  13
+:class:`Column` is derived from
  14
+:class:`~pyrseas.dbobject.DbSchemaObject` and represents a column in a
  15
+table. Its :attr:`keylist` attributes are the schema name and the
  16
+table name.
  17
+
  18
+A :class:`Column` has the following attributes: :attr:`name`,
  19
+:attr:`type`, :attr:`not_null` and :attr:`default`. The :attr:`number`
  20
+attribute is also present but is not made visible externally.
  21
+
  22
+.. autoclass:: Column
  23
+
  24
+.. automethod:: Column.to_map
  25
+
  26
+.. automethod:: Column.add
  27
+
  28
+.. automethod:: Column.drop
  29
+
  30
+.. automethod:: Column.set_sequence_default
  31
+
  32
+.. automethod:: Column.diff_map
  33
+
  34
+Column Dictionary
  35
+-----------------
  36
+
  37
+Class :class:`ColumnDict` is a dictionary derived from
  38
+:class:`~pyrseas.dbobject.DbObjectDict` and represents the collection
  39
+of columns in a database, across multiple tables. It is indexed by the
  40
+schema name and table name, and each value is a list of
  41
+:class:`Column` objects.
  42
+
  43
+.. autoclass:: ColumnDict
  44
+
  45
+.. automethod:: ColumnDict.from_map
194  docs/conf.py
... ...
@@ -0,0 +1,194 @@
  1
+# -*- coding: utf-8 -*-
  2
+#
  3
+# Pyrseas documentation build configuration file, created by
  4
+# sphinx-quickstart on Fri Dec 17 22:06:15 2010.
  5
+#
  6
+# This file is execfile()d with the current directory set to its containing dir.
  7
+#
  8
+# Note that not all possible configuration values are present in this
  9
+# autogenerated file.
  10
+#
  11
+# All configuration values have a default; values that are commented out
  12
+# serve to show the default.
  13
+
  14
+import sys, os
  15
+
  16
+# If extensions (or modules to document with autodoc) are in another directory,
  17
+# add these directories to sys.path here. If the directory is relative to the
  18
+# documentation root, use os.path.abspath to make it absolute, like shown here.
  19
+sys.path.append(os.path.abspath('.'))
  20
+
  21
+# -- General configuration -----------------------------------------------------
  22
+
  23
+# Add any Sphinx extension module names here, as strings. They can be extensions
  24
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
  25
+extensions = ['sphinx.ext.autodoc']
  26
+
  27
+# Add any paths that contain templates here, relative to this directory.
  28
+templates_path = ['_templates']
  29
+
  30
+# The suffix of source filenames.
  31
+source_suffix = '.rst'
  32
+
  33
+# The encoding of source files.
  34
+#source_encoding = 'utf-8'
  35
+
  36
+# The master toctree document.
  37
+master_doc = 'index'
  38
+
  39
+# General information about the project.
  40
+project = u'Pyrseas'
  41
+copyright = u'2011, Joe Abbate'
  42
+
  43
+# The version info for the project you're documenting, acts as replacement for
  44
+# |version| and |release|, also used in various other places throughout the
  45
+# built documents.
  46
+#
  47
+# The short X.Y version.
  48
+version = '0.1.0'
  49
+# The full version, including alpha/beta/rc tags.
  50
+release = '0.1.0'
  51
+
  52
+# The language for content autogenerated by Sphinx. Refer to documentation
  53
+# for a list of supported languages.
  54
+#language = None
  55
+
  56
+# There are two options for replacing |today|: either, you set today to some
  57
+# non-false value, then it is used:
  58
+#today = ''
  59
+# Else, today_fmt is used as the format for a strftime call.
  60
+#today_fmt = '%B %d, %Y'
  61
+
  62
+# List of documents that shouldn't be included in the build.
  63
+#unused_docs = []
  64
+
  65
+# List of directories, relative to source directory, that shouldn't be searched
  66
+# for source files.
  67
+exclude_trees = ['_build']
  68
+
  69
+# The reST default role (used for this markup: `text`) to use for all documents.
  70
+#default_role = None
  71
+
  72
+# If true, '()' will be appended to :func: etc. cross-reference text.
  73
+#add_function_parentheses = True
  74
+
  75
+# If true, the current module name will be prepended to all description
  76
+# unit titles (such as .. function::).
  77
+#add_module_names = True
  78
+
  79
+# If true, sectionauthor and moduleauthor directives will be shown in the
  80
+# output. They are ignored by default.
  81
+#show_authors = False
  82
+
  83
+# The name of the Pygments (syntax highlighting) style to use.
  84
+pygments_style = 'sphinx'
  85
+
  86
+# A list of ignored prefixes for module index sorting.
  87
+#modindex_common_prefix = []
  88
+
  89
+
  90
+# -- Options for HTML output ---------------------------------------------------
  91
+
  92
+# The theme to use for HTML and HTML Help pages.  Major themes that come with
  93
+# Sphinx are currently 'default' and 'sphinxdoc'.
  94
+html_theme = 'default'
  95
+
  96
+# Theme options are theme-specific and customize the look and feel of a theme
  97
+# further.  For a list of options available for each theme, see the
  98
+# documentation.
  99
+#html_theme_options = {}
  100
+
  101
+# Add any paths that contain custom themes here, relative to this directory.
  102
+#html_theme_path = []
  103
+
  104
+# The name for this set of Sphinx documents.  If None, it defaults to
  105
+# "<project> v<release> documentation".
  106
+#html_title = None
  107
+
  108
+# A shorter title for the navigation bar.  Default is the same as html_title.
  109
+#html_short_title = None
  110
+
  111
+# The name of an image file (relative to this directory) to place at the top
  112
+# of the sidebar.
  113
+#html_logo = None
  114
+
  115
+# The name of an image file (within the static path) to use as favicon of the
  116
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
  117
+# pixels large.
  118
+#html_favicon = None
  119
+
  120
+# Add any paths that contain custom static files (such as style sheets) here,
  121
+# relative to this directory. They are copied after the builtin static files,
  122
+# so a file named "default.css" will overwrite the builtin "default.css".
  123
+html_static_path = ['_static']
  124
+
  125
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
  126
+# using the given strftime format.
  127
+#html_last_updated_fmt = '%b %d, %Y'
  128
+
  129
+# If true, SmartyPants will be used to convert quotes and dashes to
  130
+# typographically correct entities.
  131
+#html_use_smartypants = True
  132
+
  133
+# Custom sidebar templates, maps document names to template names.
  134
+#html_sidebars = {}
  135
+
  136
+# Additional templates that should be rendered to pages, maps page names to
  137
+# template names.
  138
+#html_additional_pages = {}
  139
+
  140
+# If false, no module index is generated.
  141
+#html_use_modindex = True
  142
+
  143
+# If false, no index is generated.
  144
+#html_use_index = True
  145
+
  146
+# If true, the index is split into individual pages for each letter.
  147
+#html_split_index = False
  148
+
  149
+# If true, links to the reST sources are added to the pages.
  150
+#html_show_sourcelink = True
  151
+
  152
+# If true, an OpenSearch description file will be output, and all pages will
  153
+# contain a <link> tag referring to it.  The value of this option must be the
  154
+# base URL from which the finished HTML is served.
  155
+#html_use_opensearch = ''
  156
+
  157
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
  158
+#html_file_suffix = ''
  159
+
  160
+# Output file base name for HTML help builder.
  161
+htmlhelp_basename = 'Pyrseasdoc'
  162
+
  163
+
  164
+# -- Options for LaTeX output --------------------------------------------------
  165
+
  166
+# The paper size ('letter' or 'a4').
  167
+#latex_paper_size = 'letter'
  168
+
  169
+# The font size ('10pt', '11pt' or '12pt').
  170
+#latex_font_size = '10pt'
  171
+
  172
+# Grouping the document tree into LaTeX files. List of tuples
  173
+# (source start file, target name, title, author, documentclass [howto/manual]).
  174
+latex_documents = [
  175
+  ('index', 'Pyrseas.tex', u'Pyrseas Documentation',
  176
+   u'Joe Abbate', 'manual'),
  177
+]
  178
+
  179
+# The name of an image file (relative to this directory) to place at the top of
  180
+# the title page.
  181
+#latex_logo = None
  182
+
  183
+# For "manual" documents, if this is true, then toplevel headings are parts,
  184
+# not chapters.
  185
+#latex_use_parts = False
  186
+
  187
+# Additional stuff for the LaTeX preamble.
  188
+#latex_preamble = ''
  189
+
  190
+# Documents to append as an appendix to all manuals.
  191
+#latex_appendices = []
  192
+
  193
+# If false, no module index is generated.
  194
+#latex_use_modindex = True
87  docs/constraint.rst
Source Rendered
... ...
@@ -0,0 +1,87 @@
  1
+Constraints
  2
+===========
  3
+
  4
+.. module:: pyrseas.constraint
  5
+
  6
+The :mod:`constraint` module defines six classes: :class:`Constraint`
  7
+derived from :class:`DbSchemaObject`, classes
  8
+:class:`CheckConstraint`, :class:`PrimaryKey`, :class:`ForeignKey` and
  9
+:class:`UniqueConstraint` derived from :class:`Constraint`, and
  10
+:class:`ConstraintDict` derived from :class:`DbObjectDict`.
  11
+
  12
+Constraint
  13
+----------
  14
+
  15
+Class :class:`Constraint` is derived from
  16
+:class:`~pyrseas.dbobject.DbSchemaObject` and represents a constraint
  17
+on a database table. Its :attr:`keylist` attributes are the schema
  18
+name, the table name and the constraint name.
  19
+
  20
+.. autoclass:: Constraint
  21
+
  22
+.. automethod:: Constraint.key_columns
  23
+
  24
+.. automethod:: Constraint.add
  25
+
  26
+.. automethod:: Constraint.drop
  27
+
  28
+Check Constraint
  29
+----------------
  30
+
  31
+:class:`CheckConstraint` is derived from :class:`Constraint` and represents
  32
+a CHECK constraint.
  33
+
  34
+.. autoclass:: CheckConstraint
  35
+
  36
+.. automethod:: CheckConstraint.to_map
  37
+
  38
+.. automethod:: CheckConstraint.add
  39
+
  40
+.. automethod:: CheckConstraint.diff_map
  41
+
  42
+Primary Key
  43
+-----------
  44
+
  45
+:class:`PrimaryKey` is derived from :class:`Constraint` and represents
  46
+a primary key constraint.
  47
+
  48
+.. autoclass:: PrimaryKey
  49
+
  50
+.. automethod:: PrimaryKey.to_map
  51
+
  52
+Foreign Key
  53
+-----------
  54
+
  55
+:class:`ForeignKey` is derived from :class:`Constraint` and represents
  56
+a foreign key constraint.
  57
+
  58
+.. autoclass:: ForeignKey
  59
+
  60
+.. automethod:: ForeignKey.ref_columns
  61
+
  62
+.. automethod:: ForeignKey.to_map
  63
+
  64
+.. automethod:: ForeignKey.add
  65
+
  66
+Unique Constraint
  67
+-----------------
  68
+
  69
+:class:`UniqueConstraint` is derived from :class:`Constraint` and
  70
+represents a UNIQUE, non-primary key constraint.
  71
+
  72
+.. autoclass:: UniqueConstraint
  73
+
  74
+.. automethod:: UniqueConstraint.to_map
  75
+
  76
+Constraint Dictionary
  77
+---------------------
  78
+
  79
+Class :class:`ConstraintDict` is a dictionary derived from
  80
+:class:`~pyrseas.dbobject.DbObjectDict` and represents the collection
  81
+of constraints in a database.
  82
+
  83
+.. autoclass:: ConstraintDict
  84
+
  85
+.. automethod:: ConstraintDict.from_map
  86
+
  87
+.. automethod:: ConstraintDict.diff_map
63  docs/database.rst
Source Rendered
... ...
@@ -0,0 +1,63 @@
  1
+Databases
  2
+=========
  3
+
  4
+.. module:: pyrseas.database
  5
+
  6
+The :mod:`database` module defines :class:`Database`.
  7
+
  8
+Database
  9
+--------
  10
+
  11
+A :class:`Database` is initialized with a
  12
+:class:`~pyrseas.dbconn.DbConnection` object.  It consists of one or
  13
+two :class:`Dicts`. A :class:`Dicts` object holds various dictionary
  14
+objects derived from :class:`~pyrseas.dbobject.DbObjectDict`, e.g.,
  15
+:class:`~pyrseas.schema.SchemaDict`,
  16
+:class:`~pyrseas.table.ClassDict`, and
  17
+:class:`~pyrseas.column.ColumnDict`. The key for each dictionary is a
  18
+Python tuple (or a single value in the case of
  19
+:class:`SchemaDict`). For example, the
  20
+:class:`~pyrseas.table.ClassDict` dictionary is indexed by (`schema
  21
+name`, `table name`). In addition, object instances in each dictionary
  22
+are linked to related objects in other dictionaries, e.g., columns are
  23
+linked to the tables where they belong.
  24
+
  25
+The :attr:`db` :class:`Dicts` object --always present-- defines the
  26
+database schemas, including their tables and other objects, by
  27
+querying the system catalogs.  The :attr:`ndb` :class:`Dicts` object
  28
+defines the schemas based on the :obj:`input_map` supplied to the
  29
+:meth:`diff_map` method.
  30
+
  31
+The :meth:`to_map` method returns and the :meth:`diff_map` method
  32
+takes as input, a dictionary as shown below. It uses 'schema
  33
+`schema_name`' as the key for each schema. The value corresponding to
  34
+each 'schema `schema_name`' is another dictionary using 'sequences',
  35
+'tables', etc., as keys and more dictionaries as values. For example::
  36
+
  37
+  {'schema public':
  38
+      {'sequence seq1': { ... },
  39
+       'sequence seq2': { ... },
  40
+       'table t1': { ... },
  41
+       'table t2': { ... },
  42
+       'table t3': { ... }
  43
+      },
  44
+   'schema s1': { ... },
  45
+   'schema s2': { ... }
  46
+  }
  47
+
  48
+Refer to :class:`~pyrseas.table.Sequence` and
  49
+:class:`~pyrseas.table.Table` for details on the lower level
  50
+dictionaries.
  51
+
  52
+.. autoclass:: Database
  53
+
  54
+Methods :meth:`from_catalog` and :meth:`from_map` are for internal
  55
+use. Methods :meth:`to_map` and :meth:`diff_map` are the external API.
  56
+
  57
+.. automethod:: Database.from_catalog
  58
+
  59
+.. automethod:: Database.from_map
  60
+
  61
+.. automethod:: Database.to_map
  62
+
  63
+.. automethod:: Database.diff_map
27  docs/dbconn.rst
Source Rendered
... ...
@@ -0,0 +1,27 @@
  1
+Database Connections
  2
+====================
  3
+
  4
+.. module:: pyrseas.dbconn
  5
+
  6
+The :mod:`dbconn` module defines :class:`DbConnection`.
  7
+
  8
+Database Connection
  9
+-------------------
  10
+
  11
+A :class:`DbConnection` is a helper class representing a connection to
  12
+a `PostgreSQL <http://www.postgresql.org>`_ database via the `Psycopg
  13
+<http://initd.org/psycopg/>`_ adapter.  A :class:`DbConnection` is not
  14
+necessarily connected. It will typically connect to the database when
  15
+the :class:`~pyrseas.dbobject.DbObjectDict`
  16
+:meth:`~pyrseas.dbobject.DbObjectDict.fetch` method is first
  17
+invoked. It is normally disconnected just before the
  18
+:class:`~pyrseas.database.Database`
  19
+:meth:`~pyrseas.database.Database.from_catalog` returns.
  20
+
  21
+.. autoclass:: DbConnection
  22
+
  23
+.. automethod:: DbConnection.connect
  24
+
  25
+.. automethod:: DbConnection.fetchone
  26
+
  27
+.. automethod:: DbConnection.fetchall
61  docs/dbobject.rst
Source Rendered
... ...
@@ -0,0 +1,61 @@
  1
+Database Objects
  2
+================
  3
+
  4
+.. module:: pyrseas.dbobject
  5
+
  6
+The :mod:`dbobject` module defines two low-level classes and an
  7
+intermediate class. Most Pyrseas classes are derived from either
  8
+:class:`DbObject` or :class:`DbObjectDict`.
  9
+
  10
+Database Object
  11
+---------------
  12
+
  13
+A :class:`DbObject` represents a database object such as a
  14
+schema, table, or column, defined in a system catalog. It is
  15
+initialized from a dictionary of attributes. Derived classes should
  16
+define a :attr:`keylist` that is a list of attribute names that
  17
+uniquely identify each object instance within the database.
  18
+
  19
+.. autoclass:: DbObject
  20
+
  21
+.. automethod:: DbObject.key
  22
+
  23
+Database Object Dictionary
  24
+--------------------------
  25
+
  26
+A :class:`DbObjectDict` represents a collection of :class:`DbObject`'s
  27
+and is derived from the Python built-in type :class:`dict`. If a
  28
+:class:`~pyrseas.dbconn.DbConnection` object is used for
  29
+initialization, an internal method is called to initialize the
  30
+dictionary from the database catalogs. The :class:`DbObjectDict`
  31
+:meth:`fetch` method fetches all objects using the :attr:`query`
  32
+defined by derived classes. Derived classes should also define a
  33
+:attr:`cls` attribute for the associated :class:`DbObject` class,
  34
+e.g., :class:`~pyrseas.schema.SchemaDict` sets :attr:`cls` to
  35
+:class:`~pyrseas.schema.Schema`.
  36
+
  37
+.. autoclass:: DbObjectDict
  38
+
  39
+.. automethod:: DbObjectDict.fetch
  40
+
  41
+Schema Object
  42
+-------------
  43
+
  44
+A :class:`DbSchemaObject` is derived from :class:`DbObject`. It is
  45
+used as a base class for objects owned by a schema and to define
  46
+certain common methods. This is different from the
  47
+:class:`~pyrseas.schema.Schema` that represents the schema itself.
  48
+
  49
+.. autoclass:: DbSchemaObject
  50
+
  51
+.. automethod:: DbSchemaObject.extern_key
  52
+
  53
+.. automethod:: DbSchemaObject.qualname
  54
+
  55
+.. automethod:: DbSchemaObject.unqualify
  56
+
  57
+.. automethod:: DbSchemaObject.drop
  58
+
  59
+.. automethod:: DbSchemaObject.rename
  60
+
  61
+.. automethod:: DbSchemaObject.set_search_path
132  docs/dbtoyaml.rst
Source Rendered
... ...
@@ -0,0 +1,132 @@
  1
+dbtoyaml - Database to YAML
  2
+===========================
  3
+
  4
+Name
  5
+----
  6
+
  7
+dbtoyaml -- extract the schema of a PostgreSQL database in YAML format
  8
+
  9
+Synopsys
  10
+--------
  11
+
  12
+::
  13
+
  14
+   dbtoyaml [option...] dbname
  15
+
  16
+Description
  17
+-----------
  18
+
  19
+:program:`dbtoyaml` is a utility for extracting the schema of a
  20
+PostgreSQL database to a `YAML <http://yaml.org>`_ formatted
  21
+specification. Note that `JSON <http://json.org/>`_ is an official
  22
+subset of YAML version 1.2, so the :program:`dbtoyaml` output should
  23
+also be compatible with JSON tools.
  24
+
  25
+The output format is as follows::
  26
+
  27
+ schema public:
  28
+   table t1:
  29
+     check_constraints:
  30
+       check_expr: (c2 > 123)
  31
+       columns:
  32
+       - c2
  33
+     columns:
  34
+     - c1:
  35
+         not_null: true
  36
+         type: integer
  37
+     - c2:
  38
+         type: smallint
  39
+     - c3:
  40
+         default: 'false'
  41
+         type: boolean
  42
+     - c4:
  43
+         type: text
  44
+     primary_key:
  45
+       t1_pkey:
  46
+         access_method: btree
  47
+         columns:
  48
+         - c1
  49
+     foreign_keys:
  50
+       t1_c2_fkey:
  51
+         columns:
  52
+         - c2
  53
+         references:
  54
+           columns:
  55
+           - c21
  56
+           schema: s1 
  57
+           table: t2
  58
+ schema s1:
  59
+   table t2:
  60
+     columns:
  61
+     - c21:
  62
+          not_null: true
  63
+          type: integer
  64
+     - c22:
  65
+          type: character varying(16)
  66
+     primary_key:
  67
+       t2_pkey:
  68
+         access_method: btree
  69
+         columns:
  70
+         - c21
  71
+
  72
+The above should be mostly self-explanatory. The example database has
  73
+two tables, named ``t1`` and ``t2``, the first in the ``public``
  74
+schema and the second in a schema named ``s1``. The ``columns:``
  75
+specifications directly under each table list each column in that
  76
+table, in the same order as shown by PostgreSQL. The specifications
  77
+``primary_key:``, ``foreign_keys:`` and ``check_constraints:`` define
  78
+PRIMARY KEY, FOREIGN KEY and CHECK constraints for a given
  79
+table. Additional specifications (not shown) define unique constraints
  80
+and indexes.
  81
+
  82
+:program:`dbtoyaml` currently supports extracting information about
  83
+schemas, sequences, tables, columns, primary keys, foreign keys,
  84
+unique constraints, check constraints and indexes.
  85
+
  86
+Options
  87
+-------
  88
+
  89
+:program:`dbtoyaml` accepts the following command-line arguments:
  90
+
  91
+dbname
  92
+
  93
+    Specifies the name of the database whose schema is to extracted.
  94
+
  95
+-H `host`, --host= `host`
  96
+
  97
+    Specifies the host name of the machine on which the PostgreSQL
  98
+    server is running. The default host name is 'localhost'.
  99
+
  100
+-n `schema`, --schema= `schema`
  101
+
  102
+    Extracts only a schema matching `schema`. By default, all schemas
  103
+    are extracted.
  104
+
  105
+-p `port`, --port= `port`
  106
+
  107
+    Specifies the TCP port on which the PostgreSQL server is listening
  108
+    for connections. The default port number is 5432.
  109
+
  110
+-t `table`, \--table= `table`
  111
+
  112
+    Extract only tables matching `table`.
  113
+
  114
+-U `username`, --user= `username`
  115
+
  116
+    User name to connect as. The default user name is provided by the
  117
+    environment variable :envvar:`USER`.
  118
+
  119
+Examples
  120
+--------
  121
+
  122
+To extract a database called ``moviesdb`` into a file::
  123
+
  124
+  dbtoyaml moviesdb > moviesdb.yaml
  125
+
  126
+To extract only the schema named ``store``::
  127
+
  128
+  dbtoyaml --schema=store moviesdb > moviesdb.yaml
  129
+
  130
+To extract the tables named ``film`` and ``category``::
  131
+
  132
+  dbtoyaml -t film -t category moviesdb > moviesdb.yaml
70  docs/index.rst
Source Rendered
... ...
@@ -0,0 +1,70 @@
  1
+Pyrseas
  2
+=======
  3
+
  4
+Pyrseas provides a framework and utilities to upgrade and maintain a
  5
+relational database.  Its purpose is to enhance and follow through on
  6
+the concepts of the `Andromeda Project
  7
+<http://www.andromeda-project.org/>`_. The name comes from `Python
  8
+<http://www.python.org/>`_, the programming language, and `Perseas
  9
+<http://en.wikipedia.org/wiki/Perseus>`_ [#]_, the Greek mythological hero
  10
+who rescued Andromeda from a sea monster [#]_.
  11
+
  12
+Pyrseas currently includes the dbtoyaml utility to create a `YAML
  13
+<http://yaml.org/>`_ description of a PostgreSQL database's tables,
  14
+and the yamltodb utility to generate SQL statements to modify a
  15
+database to match an input YAML specification.
  16
+
  17
+
  18
+Contents:
  19
+
  20
+.. toctree::
  21
+   :maxdepth: 2
  22
+
  23
+   overview
  24
+.. toctree::
  25
+   :maxdepth: 1
  26
+
  27
+   dbtoyaml
  28
+   yamltodb
  29
+
  30
+API Reference
  31
+-------------
  32
+
  33
+Currently, the only external APIs are the classes
  34
+:class:`~pyrseas.dbconn.DbConnection` and
  35
+:class:`~pyrseas.database.Database` and the methods
  36
+:meth:`~pyrseas.database.Database.to_map` and
  37
+:meth:`~pyrseas.database.Database.diff_map` of the latter. Other
  38
+classes and methods are documented mainly for developer use.
  39
+
  40
+.. toctree::
  41
+   :maxdepth: 2
  42
+
  43
+   dbobject
  44
+   dbconn
  45
+   database
  46
+   schema
  47
+   table
  48
+   column
  49
+   constraint
  50
+   indexes
  51
+
  52
+Indices and tables
  53
+==================
  54
+
  55
+* :ref:`genindex`
  56
+* :ref:`modindex`
  57
+* :ref:`search`
  58
+
  59
+
  60
+.. rubric:: Footnotes
  61
+
  62
+.. [#] The common English name for Perseas is Perseus and the Ancient
  63
+   Greek name is Perseos. However, in modern Greek Περσέας_ is the
  64
+   more common spelling for the mythical hero. The project would be
  65
+   Πυρσέας or ΠΥΡΣΕΑΣ in Greek.
  66
+
  67
+.. _Περσέας: http://en.wiktionary.org/wiki/%CE%A0%CE%B5%CF%81%CF%83%CE%AD%CE%B1%CF%82
  68
+
  69
+.. [#] He is better known for having killed Medusa.
  70
+
43  docs/indexes.rst
Source Rendered
... ...
@@ -0,0 +1,43 @@
  1
+Indexes
  2
+=======
  3
+
  4
+.. module:: pyrseas.index
  5
+
  6
+The :mod:`index` module defines two classes, :class:`Index` and
  7
+:class:`IndexDict`, derived from :class:`DbSchemaObject` and
  8
+:class:`DbObjectDict`, respectively.
  9
+
  10
+Index
  11
+-----
  12
+
  13
+Class :class:`Index` is derived from
  14
+:class:`~pyrseas.dbobject.DbSchemaObject` and represents an index on a
  15
+database table, other than a primary key or unique constraint
  16
+index. Its :attr:`keylist` attributes are the schema name, the table
  17
+name and the index name.
  18
+
  19
+An :class:`Index` has the following attributes: :attr:`access_method`,
  20
+:attr:`unique`, and :attr:`keycols`.
  21
+
  22
+.. autoclass:: Index
  23
+
  24
+. automethod:: Index.key_columns
  25
+
  26
+. automethod:: Index.to_map
  27
+
  28
+.. automethod:: Index.create
  29
+
  30
+.. automethod:: Index.diff_map
  31
+
  32
+Index Dictionary
  33
+----------------
  34
+
  35
+Class :class:`IndexDict` is derived from
  36
+:class:`~pyrseas.dbobject.DbObjectDict` and represents the collection
  37
+of indexes in a database.
  38
+
  39
+.. autoclass:: IndexDict
  40
+
  41
+.. automethod:: IndexDict.from_map
  42
+
  43
+.. automethod:: IndexDict.diff_map
77  docs/overview.rst
Source Rendered
... ...
@@ -0,0 +1,77 @@
  1
+.. -*- coding: utf-8 -*-
  2
+
  3
+Overview
  4
+========
  5
+
  6
+Pyrseas provides a framework and utilities to create, upgrade and
  7
+maintain a `PostgreSQL <http://www.postgresql.org/>`_ database.  Its
  8
+purpose is to enhance and follow through on the concepts of the
  9
+`Andromeda Project <http://www.andromeda-project.org/>`_.
  10
+
  11
+Whereas Andromeda expects the database designer or developer to
  12
+provide a single `YAML <http://yaml.org/>`_ specification file of the
  13
+database to be created, Pyrseas allows the development database to be
  14
+created using the familar SQL CREATE statements.  The developer can
  15
+then run the `dbtoyaml` utility to generate the YAML specification from
  16
+the database.  The spec can then be stored in any desired VCS
  17
+repository.  Similarly, she can add columns or modify tables or other
  18
+objects using SQL ALTER statements and regenerate the YAML spec with
  19
+dbtoyaml.
  20
+
  21
+When ready to create or upgrade a test or production database, the
  22
+`yamltodb` utility can be used with the YAML spec as input, to generate
  23
+a script of SQL CREATE or ALTER statements to modify the database so
  24
+that it matches the input spec.
  25
+
  26
+Andromeda also uses the YAML specification to generate a PHP-based
  27
+application to maintain the database tables.  Pyrseas `dbappgen`
  28
+utility will allow a secondary YAML spec to generate a Python-based
  29
+administrative application for database maintenance, which can be
  30
+activated using `dbapprun`.
  31
+
  32
+Use Cases
  33
+---------
  34
+
  35
+The following two sections discuss the main scenarios where Pyrseas
  36
+tools may be helpful. The first deals with the problem of controlling
  37
+database structural changes while the second examines the topic of
  38
+repetitive database maintenance operations.
  39
+
  40
+Version Control
  41
+---------------
  42
+
  43
+The case for implementing a tool to facilitate version control over
  44
+SQL databases has been made in a couple of blog posts: `Version
  45
+Control, Part 1: Pre-SQL
  46
+<http://pyrseas.wordpress.com/2011/02/01/version-control-part-i-pre-sql/>`_
  47
+and `Version Control, Part 2: SQL Databases
  48
+<http://pyrseas.wordpress.com/2011/02/07/version-control-part-2-sql-databases/>`_. In
  49
+summary, SQL data definition commands are generally incompatible with
  50
+traditional version control approaches which usually require
  51
+comparisons (diffs) between revisions of source files.
  52
+
  53
+The Pyrseas version control tools are not designed to be the ultimate
  54
+SQL database version control solution. Instead, they are aimed at
  55
+assisting two or more developers or DbAs in sharing changes to the
  56
+underlying database as they implement a database application. The
  57
+sharing can occur through a centralized or distributed VCS. The
  58
+Pyrseas tools may even be used by a single DbA in conjunction with a
  59
+distributed VCS to quickly explore alternative designs. The tools can
  60
+also help to share changes with a conventional QA team, but may
  61
+require additional controls for final releases and production
  62
+installations.
  63
+
  64
+Data Maintenance
  65
+----------------
  66
+
  67
+Pyrseas data administration tools (to be developed) aim to supplement
  68
+the agile database development process mentioned above. While there
  69
+are tools such as `pgAdmin III <http://www.pgadmin.org/>`_ that can be
  70
+used for routine data entry tasks, their scope of action is usually a
  71
+single table. For example, if you're entering data for a customer
  72
+invoice, you need to know (or find by querying) the customer ID. On
  73
+the other hand, `Django's admin site application
  74
+<http://docs.djangoproject.com/en/1.2/intro/tutorial02/>`_ can present
  75
+more than one table on a web page, but it requires defining the
  76
+database "model" in Python and has limitations on how the database can
  77
+be structured.
60  docs/schema.rst
Source Rendered
... ...
@@ -0,0 +1,60 @@
  1
+Schemas
  2
+=======
  3
+
  4
+.. module:: pyrseas.schema
  5
+
  6
+The :mod:`schema` module defines two classes, :class:`Schema` and
  7
+:class:`SchemaDict`, derived from :class:`DbObject` and
  8
+:class:`DbObjectDict`, respectively.
  9
+
  10
+Schema
  11
+------
  12
+
  13
+:class:`Schema` is derived from :class:`~pyrseas.dbobject.DbObject`
  14
+and represents a database schema, i.e., a collection of tables and
  15
+other objects. The 'public' schema is special as in most contexts an
  16
+unqualified object is assumed to be part of it, e.g., table "t" is
  17
+usually shorthand for table "public.t."
  18
+
  19
+For now, the schema :attr:`name` is the only attribute and is of
  20
+course the identifying attribute in the :class:`Schema`
  21
+:attr:`keylist`.
  22
+
  23
+.. autoclass:: Schema
  24
+
  25
+.. automethod:: Schema.extern_key
  26
+
  27
+.. automethod:: Schema.to_map
  28
+
  29
+.. automethod:: Schema.create
  30
+
  31
+.. automethod:: Schema.drop
  32
+
  33
+.. automethod:: Schema.rename
  34
+
  35
+Schema Dictionary
  36
+-----------------
  37
+
  38
+:class:`SchemaDict` is derived from
  39
+:class:`~pyrseas.dbobject.DbObjectDict`. It is a dictionary that
  40
+represents the collection of schemas in a database. Certain internal
  41
+schemas (information_schema, pg_catalog, etc.) owned by the 'postgres'
  42
+user are excluded.
  43
+
  44
+.. autoclass:: SchemaDict
  45
+
  46
+Method :meth:`from_map` is called from :class:`Database`
  47
+:meth:`~pyrseas.database.Database.from_map` to start a recursive
  48
+interpretation of the input map. The :obj:`inmap` argument is the same
  49
+as input to the :meth:`~pyrseas.database.Database.diff_map` method of
  50
+:class:`Database`. The :obj:`newdb` argument is the holder of
  51
+:class:`~pyrseas.dbobject.DbObjectDict`-derived dictionaries which is
  52
+filled in as the recursive interpretation proceeds.
  53
+
  54
+.. automethod:: SchemaDict.from_map
  55
+
  56
+.. automethod:: SchemaDict.link_refs
  57
+
  58
+.. automethod:: SchemaDict.to_map
  59
+
  60
+.. automethod:: SchemaDict.diff_map
123  docs/table.rst
Source Rendered
... ...
@@ -0,0 +1,123 @@
  1
+Tables, Views and Sequences
  2
+===========================
  3
+
  4
+.. module:: pyrseas.table
  5
+
  6
+The :mod:`table` module defines four classes, :class:`DbClass` derived
  7
+from :class:`DbSchemaObject`, classes :class:`Sequence` and
  8
+:class:`Table` derived from :class:`DbClass`, and :class:`ClassDict`,
  9
+derived from :class:`DbObjectDict`.
  10
+
  11
+Database Class
  12
+--------------
  13
+
  14
+Class :class:`DbClass` is derived from
  15
+:class:`~pyrseas.dbobject.DbSchemaObject` and represents a table, view
  16
+or sequence as defined in the PostgreSQL `pg_class` catalog. Note:
  17
+Views are not implemented yet.
  18
+
  19
+Sequence
  20
+--------
  21
+
  22
+Class :class:`Sequence` is derived from :class:`DbClass` and
  23
+represents a sequence generator. Its :attr:`keylist` attributes are
  24
+the schema name and the sequence name.
  25
+
  26
+A :class:`Sequence` has the following attributes: :attr:`start_value`,
  27
+:attr:`increment_by`, :attr:`max_value`, :attr:`min_value` and
  28
+:attr:`cache_value`.
  29
+
  30
+The map returned by :meth:`to_map` and expected as argument by
  31
+:meth:`diff_map` has the following structure::
  32
+
  33
+  {'sequence seq1':
  34
+      {'start_value': 1,
  35
+       'increment_by': 1,
  36
+       'max_value': None,
  37
+       'min_value': None,
  38
+       'cache_value': 1
  39
+      }
  40
+  }
  41
+
  42
+Only the inner dictionary is passed to :meth:`diff_map`.  The values
  43
+are defaults so in practice an empty dictionary is also acceptable.
  44
+
  45
+.. autoclass:: Sequence
  46
+
  47
+.. automethod:: Sequence.get_attrs
  48
+
  49
+.. automethod:: Sequence.to_map
  50
+
  51
+.. automethod:: Sequence.create
  52
+
  53
+.. automethod:: Sequence.add_owner
  54
+
  55
+.. automethod:: Sequence.diff_map
  56
+
  57
+Table
  58
+-----
  59
+
  60
+Class :class:`Table` is derived from :class:`DbClass` and represents a
  61
+database table. Its :attr:`keylist` attributes are the schema name and
  62
+the table name.
  63
+
  64
+The map returned by :meth:`to_map` and expected as argument by
  65
+:meth:`diff_map` has a structure similar to the following::
  66
+
  67
+ {'table t1':
  68
+     {'columns':
  69
+         [
  70
+	 {'c1': {'type': 'integer', 'not_null': True}},
  71
+         {'c2': {'type': 'text'}},
  72
+         {'c3': {'type': 'smallint'},
  73
+         {'c4': {'type': 'date', 'default': 'now()'}}
  74
+	 ]
  75
+     },
  76
+     'primary_key':
  77
+         {'t1_prim_key':
  78
+             {'columns': ['c1', 'c2'], 'access_method': 'btree'}
  79
+     },
  80
+     'foreign_keys':
  81
+         {'t1_fgn_key1':
  82
+             {'columns': ['c2', 'c3'],
  83
+               'references':
  84
+                   {'table': 't2', 'columns': ['pc2', 'pc1']}
  85
+             },
  86
+          't1_fgn_key2':
  87
+             {'columns': ['c2'],
  88
+              'references': {'table': 't3', 'columns': ['qc1']}
  89
+             }
  90
+         }
  91
+     'unique_constraints': {...},
  92
+     'indexes': {...}
  93
+     }
  94
+ }
  95
+
  96
+The values for :obj:`unique_constraints` and :obj:`indexes` follow a
  97
+pattern similar to :obj:`primary_key`, but there can be more than one
  98
+such specification.
  99
+
  100
+.. autoclass:: Table
  101
+
  102
+.. automethod:: Table.column_names
  103
+
  104
+.. automethod:: Table.to_map
  105
+
  106
+.. automethod:: Table.create
  107
+
  108
+.. automethod:: Table.diff_map
  109
+
  110
+Class Dictionary
  111
+----------------
  112
+
  113
+Class :class:`ClassDict` is derived from
  114
+:class:`~pyrseas.dbobject.DbObjectDict` and represents the collection
  115
+of tables, views and sequences in a database.
  116
+
  117
+.. autoclass:: ClassDict
  118
+
  119
+.. automethod:: ClassDict.from_map
  120
+
  121
+.. automethod:: ClassDict.link_refs
  122
+
  123
+.. automethod:: ClassDict.diff_map
85  docs/yamltodb.rst
Source Rendered
... ...
@@ -0,0 +1,85 @@
  1
+yamltodb - YAML to Database
  2
+===========================
  3
+
  4
+Name
  5
+----
  6
+
  7
+yamltodb -- generate SQL statements to update a PostgreSQL database to
  8
+match the schema specified in a YAML file
  9
+
  10
+Synopsys
  11
+--------
  12
+
  13
+::
  14
+
  15
+   yamltodb [option...] dbname yamlspec
  16
+
  17
+Description
  18
+-----------
  19
+
  20
+:program:`yamltodb` is a utility for generating SQL statements to
  21
+update a PostgreSQL database so that it will match the schema
  22
+specified in an input `YAML <http://yaml.org>`_ formatted
  23