Permalink
Browse files

version 0.5.1

  • Loading branch information...
1 parent 405ab0a commit 66f9bfa6d76115723b61d3573606bf169288a6c4 mitch committed Nov 10, 2009
Showing with 1,136 additions and 586 deletions.
  1. +16 −0 CHANGES
  2. +13 −0 LICENSE
  3. +48 −36 README
  4. BIN docs/_build/doctrees/api/column.doctree
  5. BIN docs/_build/doctrees/api/database.doctree
  6. BIN docs/_build/doctrees/api/option.doctree
  7. BIN docs/_build/doctrees/api/table.doctree
  8. BIN docs/_build/doctrees/environment.pickle
  9. BIN docs/_build/doctrees/index.doctree
  10. +1 −1 docs/_build/html/.buildinfo
  11. +59 −58 docs/_build/html/_sources/index.txt
  12. +137 −17 docs/_build/html/api/column.html
  13. +10 −10 docs/_build/html/api/database.html
  14. +5 −5 docs/_build/html/api/foreignkey.html
  15. +5 −5 docs/_build/html/api/index.html
  16. +46 −22 docs/_build/html/api/option.html
  17. +9 −9 docs/_build/html/api/schema.html
  18. +187 −12 docs/_build/html/api/table.html
  19. +46 −16 docs/_build/html/genindex.html
  20. +55 −71 docs/_build/html/index.html
  21. +17 −5 docs/_build/html/modindex.html
  22. +30 −10 docs/_build/html/objects.inv
  23. +5 −5 docs/_build/html/search.html
  24. +1 −1 docs/_build/html/searchindex.js
  25. +1 −1 docs/conf.py
  26. +59 −58 docs/index.rst
  27. +1 −1 schemaobject/__init__.py
  28. +23 −8 schemaobject/collections.py
  29. +23 −9 schemaobject/column.py
  30. +23 −15 schemaobject/connection.py
  31. +9 −9 schemaobject/database.py
  32. +4 −4 schemaobject/foreignkey.py
  33. +9 −3 schemaobject/option.py
  34. +4 −2 schemaobject/schema.py
  35. +19 −10 schemaobject/table.py
  36. +3 −4 setup.py
  37. +0 −6 tests/config.py
  38. BIN tests/sakila-db-08.tar.gz
  39. +43 −0 tests/test_all.py
  40. +29 −9 tests/test_collections.py
  41. +77 −49 tests/test_column.py
  42. +16 −16 tests/test_connection.py
  43. +12 −11 tests/test_database.py
  44. +18 −16 tests/test_foreignkey.py
  45. +39 −37 tests/test_index.py
  46. +10 −10 tests/test_option.py
  47. +6 −8 tests/test_schema.py
  48. +18 −17 tests/test_table.py
View
16 CHANGES
@@ -0,0 +1,16 @@
+== 0.5.1 / 2009-10-10
+ * bug fixes
+ * updated test configuration, added more tests
+ * added ability to retrieve comments on columns
+ * updated collections.orderedDict
+ - added support for index(), insert() and __delitem__()
+ * changed output of database options
+ - CHARSET is now CHARACTER SET
+ - <key> <value> is now <key>=<value>
+ * newlines and multiple spaces removed from table.create() string
+ * Changed DatabaseConnection to explicitly require a call to connect()
+ * backported to work with python 2.4
+ * schema name dropped from table.alter() and table.drop() to be consistent with table.create()
+
+== 0.5.0 / 2009-09-17
+ * Initial public release
View
13 LICENSE
@@ -0,0 +1,13 @@
+Copyright 2009 Mitch Matuson
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
View
84 README
@@ -1,51 +1,63 @@
-SchemaObject v0.5
-+++++++++++++++++
+SchemaObject v0.5.1 documentation
++++++++++++++++++++++++++++++++++
-Introduction
-============
-SchemaObject creates an object representation of a MySQL schema including its databases, tables, columns, indexes, and foreign keys. It allows you to process and iterate over a MySQL schema through python object properties and methods.
+SchemaObject provides a simple, easy to use Python object interface to a MySQL database schema. You can effortlessly write tools to test, validate, sync, migrate, or manage your schema as well as generate the SQL necessary to make changes to the it.
-You can generate the SQL syntax for creating, altering and dropping any part of the schema. As of v0.5, a separate process is needed to push any generated changes to your database instance/schema.
+Example 1: Verify all tables are InnoDB
+---------------------------------------
+ import schemaobject
+ schema = schemaobject.SchemaObject('mysql://username:password@localhost:3306/mydb')
+ tables = schema.databases['mydb'].tables #or schema.selected.tables
+ for t in tables:
+ assert tables[t].options['engine'].value == 'InnoDB'
+
+
+Example 2: Verify our MySQL instance is at least version 5.1
+------------------------------------------------------------
+ import schemaobject
+ schema = schemaobject.SchemaObject('mysql://username:password@localhost:3306/mydb')
+ assert schema.version >= '5.1.0'
+
+
+Notes and Limitations
+---------------------
+* SchemaObject instances are read-only. Modifying the object or calling create(), modify(), alter(), or drop() will not change your schema.
+* The MySQL User needs to have privileges to execute SELECT and SHOW statements, as well as access the INFORMATION_SCHEMA.
+* All Databases, Tables, Columns, Indexes, and Foreign Keys are lazily loaded.
+* SchemaObject does not load Events, Triggers, or Stored Procedures.
-Dependancies and Requirements
-=============================
-* Python 2.5
-* MySQLdb
+Download and Install
+====================
+
+Prerequisites
+-------------
+* SchemaObject has been tested against Python 2.4, 2.5, and 2.6.
+* To use SchemaObject, you need to have MySQL <http://www.mysql.com/>, version 5.0 or higher and MySQLdb <http://sourceforge.net/projects/mysql-python>, version 1.2.1p2 or higher installed.
+* To run the test suite, you need to install a copy of the Sakila Database <http://dev.mysql.com/doc/sakila/en/sakila.html>, version 0.8
-Installing with easy_install
-============================
+Installing with easy_install
+----------------------------
sudo easy_install schemaobject
Installing the latest development version
-=========================================
+-----------------------------------------
+ git clone git://github.com/mmatuson/SchemaObject.git
+ cd schemaobject
+ sudo python setup.py install
+
- $ git clone git://github.com/mmatuson/SchemaObject.git
- $ cd schemaobject
- $ sudo python setup.py develop
-
- *OR*
-
- $ sudo python setup.py develop
-
Documentation
=============
-Documentation is available @ http://matuson.com/code/schemaobject
+Documentation is available @ http://matuson.com/code/schemaobject/
+
+Status & License
+================
+SchemaObject is under active development and released under the Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>.
+You can obtain a copy of the latest source code from the Git repository <http://github.com/mmatuson/SchemaObject>, or fork it on Github <http://www.github.com>.
-Examples
-========
-Verify all tables in our database are InnoDB::
-
- import schemaobject
- schema = schemaobject.SchemaObject('mysql://username:password@localhost:3306/mydb')
- tables = schema.databases['mydb'].tables #or schema.selected.tables
- for t in tables:
- assert tables[t].options['engine'].value == 'InnoDB'
-
-Verify our MySQL instance is version 5.x+::
+You can report bugs via the SchemaObject Issues page <http://github.com/mmatuson/SchemaObject/issues>
- import schemaobject
- schema = schemaobject.SchemaObject('mysql://username:password@localhost:3306/mydb')
- assert int(schema.version[:1]) >= 5 #test against the major # of the version string
+Comments, questions, and feature requests can be sent to code at matuson dot com
View
BIN docs/_build/doctrees/api/column.doctree
Binary file not shown.
View
BIN docs/_build/doctrees/api/database.doctree
Binary file not shown.
View
BIN docs/_build/doctrees/api/option.doctree
Binary file not shown.
View
BIN docs/_build/doctrees/api/table.doctree
Binary file not shown.
View
BIN docs/_build/doctrees/environment.pickle
Binary file not shown.
View
BIN docs/_build/doctrees/index.doctree
Binary file not shown.
View
2 docs/_build/html/.buildinfo
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: 189fedddec8b2bc13990cbf7dd1e6bae
+config: f3c667b3f33a8c748c47e756f9befa46
tags: fbb0d17656682115ca4d033fb2f83ba1
View
117 docs/_build/html/_sources/index.txt
@@ -1,52 +1,62 @@
-.. SchemaObject documentation master file, created by
- sphinx-qschemaobjectuickstart on Wed Sep 16 09:45:22 2009.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
+SchemaObject v0.5.1 documentation
++++++++++++++++++++++++++++++++++
-SchemaObject v0.5 documentation
-+++++++++++++++++++++++++++++++
+Introduction and Examples
+-------------------------
+SchemaObject provides a simple, easy to use Python object interface to a MySQL database schema. You can effortlessly write tools to test, validate, sync, migrate, or manage your schema as well as generate the SQL necessary to make changes to it.
-Introduction
-============
-SchemaObject creates an object representation of a MySQL schema including its databases, tables, columns, indexes, and foreign keys. It allows you to process and iterate over a MySQL schema through python object properties and methods.
+**Verify all tables are InnoDB**
-You can generate the SQL syntax for creating, altering and dropping any part of the schema. As of v0.5, a separate process is needed to push any generated changes to your database instance/schema.
+::
-Status & License
-================
-SchemaObject is under active development and released under the `Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>`_. You can obtain a copy of the latest source code from the `Git repository <http://github.com/mmatuson/SchemaObject>`_, or fork it on `Github <http://www.github.com>`_.
+ import schemaobject
+ schema = schemaobject.SchemaObject('mysql://username:password@localhost:3306/mydb')
+ tables = schema.databases['mydb'].tables #or schema.selected.tables
+ for t in tables:
+ assert tables[t].options['engine'].value == 'InnoDB'
+
+
+**Verify our MySQL instance is at least version 5.1**
+
+::
+
+ import schemaobject
+ schema = schemaobject.SchemaObject('mysql://username:password@localhost:3306/mydb')
+ assert schema.version >= '5.1.0'
+
+
+**Notes and Limitations**
+
+* SchemaObject instances are read-only. Modifying the object or calling create(), modify(), alter(), or drop() will not change your schema.
+* The MySQL User needs to have privileges to execute SELECT and SHOW statements, as well as access the INFORMATION_SCHEMA.
+* All Databases, Tables, Columns, Indexes, and Foreign Keys are lazily loaded.
+* SchemaObject does not load Events, Triggers, or Stored Procedures.
-Installation
-=============
+Download and Install
+--------------------
-Dependancies and Requirements
------------------------------
-* Python 2.5
-* MySQLdb
+**Prerequisites**
-Installing with easy_install
---------------------------------
-Simply run the following command::
+* SchemaObject has been tested against Python 2.4, 2.5, and 2.6.
+* To use SchemaObject, you need to have `MySQL <http://www.mysql.com/>`_, version 5.0 or higher and `MySQLdb <http://sourceforge.net/projects/mysql-python>`_, version 1.2.1p2 or higher installed.
+* To run the test suite, you need to install a copy of the `Sakila Database <http://dev.mysql.com/doc/sakila/en/sakila.html>`_, version 0.8
- $ sudo easy_install schemaobject
-Installing the latest development version
-------------------------------------------
+**Installing with easy_install**
+::
-Standard install::
+ sudo easy_install schemaobject
- $ git clone git://github.com/mmatuson/SchemaObject.git
- $ cd schemaobject
- $ sudo python setup.py install
+**Installing the latest development version**
+::
-Development Mode::
+ git clone git://github.com/mmatuson/SchemaObject.git
+ cd schemaobject
+ sudo python setup.py install
- $ git clone git://github.com/mmatuson/SchemaObject.git
- $ cd schemaobject
- $ sudo python setup.py develop
Documentation
-=============
+-------------
.. toctree::
:maxdepth: 1
@@ -57,29 +67,20 @@ Documentation
api/index.rst
api/foreignkey.rst
api/option.rst
-
+
+
+Projects using SchemaObject
+---------------------------
+Schema Sync - a MySQL schema synchronization utility
-
-Examples
-==============
-Verify all tables in our database are InnoDB::
-
- import schemaobject
- schema = schemaobject.SchemaObject('mysql://username:password@localhost:3306/mydb')
- tables = schema.databases['mydb'].tables #or schema.selected.tables
- for t in tables:
- assert tables[t].options['engine'].value == 'InnoDB'
-
-Verify our MySQL instance is version 5.x+::
+
+Status & License
+-----------------
+SchemaObject is under active development and released under the `Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>`_.
+
+You can obtain a copy of the latest source code from the `Git repository <http://github.com/mmatuson/SchemaObject>`_, or fork it on `Github <http://www.github.com>`_.
+
+You can report bugs via the `SchemaObject Issues page <http://github.com/mmatuson/SchemaObject/issues>`_.
+
+Comments, questions, and feature requests can be sent to code at matuson dot com
- import schemaobject
- schema = schemaobject.SchemaObject('mysql://username:password@localhost:3306/mydb')
- assert int(schema.version[:1]) >= 5 #test against the major # of the version string
-
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
View
154 docs/_build/html/api/column.html
@@ -5,23 +5,23 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Column &mdash; SchemaObject v0.5 documentation</title>
+ <title>Column &mdash; SchemaObject v0.5.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
- VERSION: '0.5',
+ VERSION: '0.5.1',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
- <link rel="top" title="SchemaObject v0.5 documentation" href="../index.html" />
- <link rel="next" title="Database" href="database.html" />
- <link rel="prev" title="SchemaObject v0.5 documentation" href="../index.html" />
+ <link rel="top" title="SchemaObject v0.5.1 documentation" href="../index.html" />
+ <link rel="next" title="Index" href="index.html" />
+ <link rel="prev" title="Table" href="table.html" />
</head>
<body>
<div class="related">
@@ -34,12 +34,12 @@
<a href="../modindex.html" title="Global Module Index"
accesskey="M">modules</a> |</li>
<li class="right" >
- <a href="database.html" title="Database"
+ <a href="index.html" title="Index"
accesskey="N">next</a> |</li>
<li class="right" >
- <a href="../index.html" title="SchemaObject v0.5 documentation"
+ <a href="table.html" title="Table"
accesskey="P">previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
@@ -48,8 +48,128 @@
<div class="bodywrapper">
<div class="body">
- <div class="section" id="column">
-<h1>Column<a class="headerlink" href="#column" title="Permalink to this headline">¶</a></h1>
+ <div class="section" id="module-schemaobject.column">
+<h1>Column<a class="headerlink" href="#module-schemaobject.column" title="Permalink to this headline">¶</a></h1>
+<dl class="class">
+<dt id="schemaobject.column.ColumnSchema">
+<em class="property">class </em><tt class="descclassname">schemaobject.column.</tt><tt class="descname">ColumnSchema</tt><big>(</big><em>name</em>, <em>parent</em><big>)</big><a class="headerlink" href="#schemaobject.column.ColumnSchema" title="Permalink to this definition">¶</a></dt>
+<dd><p>Object representation of a single column.
+Supports equality and inequality comparison of ColumnSchema.</p>
+<p><tt class="docutils literal"><span class="pre">name</span></tt> is the column name.
+<tt class="docutils literal"><span class="pre">parent</span></tt> is an instance of TableSchema</p>
+<div class="admonition note">
+<p class="first admonition-title">Note</p>
+<p class="last">ColumnSchema objects are automatically created for you by ColumnSchemaBuilder
+and loaded under <tt class="docutils literal"><span class="pre">schema.databases[name].tables[name].columns</span></tt></p>
+</div>
+<div class="admonition note">
+<p class="first admonition-title">Note</p>
+<p class="last">Attributes <tt class="docutils literal"><span class="pre">key</span></tt>, <tt class="docutils literal"><span class="pre">comment</span></tt> are ignored in <tt class="docutils literal"><span class="pre">__eq__</span></tt>, <tt class="docutils literal"><span class="pre">__neq__</span></tt> comparisons.</p>
+</div>
+<p>Example</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
+<span class="go">[&#39;rental_id&#39;, &#39;rental_date&#39;, &#39;inventory_id&#39;, &#39;customer_id&#39;, &#39;return_date&#39;, &#39;staff_id&#39;, &#39;last_update&#39;]</span>
+</pre></div>
+</div>
+<dl class="docutils">
+<dt>Column Attributes</dt>
+<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;rental_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">name</span>
+<span class="go">&#39;rental_id&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;rental_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">field</span>
+<span class="go">&#39;rental_id&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;rental_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">ordinal_position</span>
+<span class="go">1L</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;rental_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">type</span>
+<span class="go">&#39;INT(11)&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;staff&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;password&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">charset</span>
+<span class="go">&#39;utf8&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;staff&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;password&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">collation</span>
+<span class="go">&#39;utf8_bin&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;rental_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">null</span>
+<span class="go">False</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;rental_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">key</span>
+<span class="go">&#39;PRI&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;last_update&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">default</span>
+<span class="go">&#39;CURRENT_TIMESTAMP&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;rental_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">extra</span>
+<span class="go">&#39;auto_increment&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;rental_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">comment</span>
+<span class="go">&#39;&#39;</span>
+</pre></div>
+</div>
+</dd>
+</dl>
+<dl class="method">
+<dt id="schemaobject.column.ColumnSchema.create">
+<tt class="descname">create</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#schemaobject.column.ColumnSchema.create" title="Permalink to this definition">¶</a></dt>
+<dd><p>Generate the SQL to create (ADD) this column.</p>
+<p><tt class="docutils literal"><span class="pre">after</span></tt> is the name(string) of the column this should appear after.
+If <tt class="docutils literal"><span class="pre">after</span></tt> is None, <tt class="docutils literal"><span class="pre">FIRST</span></tt> is used.</p>
+<p><tt class="docutils literal"><span class="pre">with_comment</span></tt> boolean, add column comment to sql statement</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;last_update&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">after</span><span class="o">=</span><span class="s">&quot;staff_id&quot;</span><span class="p">)</span>
+<span class="go">&#39;ADD COLUMN `last_update` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP AFTER `staff_id`&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;rental_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">create</span><span class="p">()</span>
+<span class="go">&#39;ADD COLUMN `rental_id` INT(11) NOT NULL auto_increment FIRST&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="method">
+<dt id="schemaobject.column.ColumnSchema.define">
+<tt class="descname">define</tt><big>(</big><em>after=None</em>, <em>with_comment=False</em><big>)</big><a class="headerlink" href="#schemaobject.column.ColumnSchema.define" title="Permalink to this definition">¶</a></dt>
+<dd><p>Generate the SQL for this column definition.</p>
+<p><tt class="docutils literal"><span class="pre">after</span></tt> is the name(string) of the column this should appear after.
+If <tt class="docutils literal"><span class="pre">after</span></tt> is None, <tt class="docutils literal"><span class="pre">FIRST</span></tt> is used.</p>
+<p><tt class="docutils literal"><span class="pre">with_comment</span></tt> boolean, add column comment to sql statement</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;last_update&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">define</span><span class="p">(</span><span class="n">after</span><span class="o">=</span><span class="s">&quot;staff_id&quot;</span><span class="p">)</span>
+<span class="go">&#39;`last_update` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP AFTER `staff_id`&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;rental_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">define</span><span class="p">()</span>
+<span class="go">&#39;`rental_id` INT(11) NOT NULL auto_increment FIRST&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="method">
+<dt id="schemaobject.column.ColumnSchema.drop">
+<tt class="descname">drop</tt><big>(</big><big>)</big><a class="headerlink" href="#schemaobject.column.ColumnSchema.drop" title="Permalink to this definition">¶</a></dt>
+<dd><p>Generate the SQL to drop this column:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;rental_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">drop</span><span class="p">()</span>
+<span class="go">&#39;DROP COLUMN `rental_id`&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="method">
+<dt id="schemaobject.column.ColumnSchema.modify">
+<tt class="descname">modify</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#schemaobject.column.ColumnSchema.modify" title="Permalink to this definition">¶</a></dt>
+<dd><p>Generate the SQL to modify this column.</p>
+<p><tt class="docutils literal"><span class="pre">after</span></tt> is the name(string) of the column this should appear after.
+If <tt class="docutils literal"><span class="pre">after</span></tt> is None, <tt class="docutils literal"><span class="pre">FIRST</span></tt> is used.x</p>
+<p><tt class="docutils literal"><span class="pre">with_comment</span></tt> boolean, add column comment to sql statement</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;customer_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">define</span><span class="p">(</span><span class="n">after</span><span class="o">=</span><span class="s">&quot;inventory_id&quot;</span><span class="p">)</span>
+<span class="go">&#39;`customer_id` SMALLINT(5) UNSIGNED NOT NULL AFTER `inventory_id`&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;customer_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">default</span> <span class="o">=</span> <span class="mi">123</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="s">&#39;customer_id&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">modify</span><span class="p">(</span><span class="n">after</span><span class="o">=</span><span class="s">&quot;inventory_id&quot;</span><span class="p">)</span>
+<span class="go">&#39;MODIFY COLUMN `customer_id` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 123 AFTER `inventory_id`&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="schemaobject.column.ColumnSchemaBuilder">
+<tt class="descclassname">schemaobject.column.</tt><tt class="descname">ColumnSchemaBuilder</tt><big>(</big><em>table</em><big>)</big><a class="headerlink" href="#schemaobject.column.ColumnSchemaBuilder" title="Permalink to this definition">¶</a></dt>
+<dd><p>Returns a dictionary loaded with all of the columns availale in the table.
+<tt class="docutils literal"><span class="pre">table</span></tt> must be an instance of TableSchema.</p>
+<div class="admonition note">
+<p class="first admonition-title">Note</p>
+<p class="last">This function is automatically called for you and set to
+<tt class="docutils literal"><span class="pre">schema.databases[name].tables[name].columns</span></tt>
+when you create an instance of SchemaObject</p>
+</div>
+</dd></dl>
+
</div>
@@ -59,11 +179,11 @@
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
- <p class="topless"><a href="../index.html"
- title="previous chapter">SchemaObject v0.5 documentation</a></p>
+ <p class="topless"><a href="table.html"
+ title="previous chapter">Table</a></p>
<h4>Next topic</h4>
- <p class="topless"><a href="database.html"
- title="next chapter">Database</a></p>
+ <p class="topless"><a href="index.html"
+ title="next chapter">Index</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/api/column.txt"
@@ -96,12 +216,12 @@
<a href="../modindex.html" title="Global Module Index"
>modules</a> |</li>
<li class="right" >
- <a href="database.html" title="Database"
+ <a href="index.html" title="Index"
>next</a> |</li>
<li class="right" >
- <a href="../index.html" title="SchemaObject v0.5 documentation"
+ <a href="table.html" title="Table"
>previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
View
20 docs/_build/html/api/database.html
@@ -5,21 +5,21 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Database &mdash; SchemaObject v0.5 documentation</title>
+ <title>Database &mdash; SchemaObject v0.5.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
- VERSION: '0.5',
+ VERSION: '0.5.1',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
- <link rel="top" title="SchemaObject v0.5 documentation" href="../index.html" />
+ <link rel="top" title="SchemaObject v0.5.1 documentation" href="../index.html" />
<link rel="next" title="Table" href="table.html" />
<link rel="prev" title="Schema (MySQL Instance)" href="schema.html" />
</head>
@@ -39,7 +39,7 @@
<li class="right" >
<a href="schema.html" title="Schema (MySQL Instance)"
accesskey="P">previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
@@ -68,7 +68,7 @@
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
-<p class="last">DatabaseSchema objects are automatically created for you
+<p class="last">DatabaseSchema objects are automatically created for you
by DatabaseSchemaBuilder and loaded under <tt class="docutils literal"><span class="pre">schema.databases</span></tt></p>
</div>
<dl class="method">
@@ -90,7 +90,7 @@
<dd><dl class="docutils">
<dt>Generate the SQL to create this databse</dt>
<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">create</span><span class="p">()</span>
-<span class="go">&#39;CREATE DATABASE `sakila` CHARACTER SET latin1 COLLATE latin1_swedish_ci;&#39;</span>
+<span class="go">&#39;CREATE DATABASE `sakila` CHARACTER SET=latin1 COLLATE=latin1_swedish_ci;&#39;</span>
</pre></div>
</div>
</dd>
@@ -151,12 +151,12 @@
<dl class="function">
<dt id="schemaobject.database.DatabaseSchemaBuilder">
<tt class="descclassname">schemaobject.database.</tt><tt class="descname">DatabaseSchemaBuilder</tt><big>(</big><em>instance</em><big>)</big><a class="headerlink" href="#schemaobject.database.DatabaseSchemaBuilder" title="Permalink to this definition">¶</a></dt>
-<dd><p>Returns a dictionary loaded with all of the databases availale on
+<dd><p>Returns a dictionary loaded with all of the databases availale on
the MySQL instance. <tt class="docutils literal"><span class="pre">instance</span></tt> must be an instance SchemaObject.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
-<p class="last">This function is automatically called for you and set to
-<a href="#id1"><span class="problematic" id="id2">``</span></a>schema.databses``when you create an instance of SchemaObject</p>
+<p class="last">This function is automatically called for you and set to
+<a href="#id1"><span class="problematic" id="id2">``</span></a>schema.databases``when you create an instance of SchemaObject</p>
</div>
</dd></dl>
@@ -211,7 +211,7 @@
<li class="right" >
<a href="schema.html" title="Schema (MySQL Instance)"
>previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
View
10 docs/_build/html/api/foreignkey.html
@@ -5,21 +5,21 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Foreign Key &mdash; SchemaObject v0.5 documentation</title>
+ <title>Foreign Key &mdash; SchemaObject v0.5.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
- VERSION: '0.5',
+ VERSION: '0.5.1',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
- <link rel="top" title="SchemaObject v0.5 documentation" href="../index.html" />
+ <link rel="top" title="SchemaObject v0.5.1 documentation" href="../index.html" />
<link rel="next" title="Option" href="option.html" />
<link rel="prev" title="Index" href="index.html" />
</head>
@@ -39,7 +39,7 @@
<li class="right" >
<a href="index.html" title="Index"
accesskey="P">previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
@@ -183,7 +183,7 @@
<li class="right" >
<a href="index.html" title="Index"
>previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
View
10 docs/_build/html/api/index.html
@@ -5,21 +5,21 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Index &mdash; SchemaObject v0.5 documentation</title>
+ <title>Index &mdash; SchemaObject v0.5.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
- VERSION: '0.5',
+ VERSION: '0.5.1',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
- <link rel="top" title="SchemaObject v0.5 documentation" href="../index.html" />
+ <link rel="top" title="SchemaObject v0.5.1 documentation" href="../index.html" />
<link rel="next" title="Foreign Key" href="foreignkey.html" />
<link rel="prev" title="Column" href="column.html" />
</head>
@@ -39,7 +39,7 @@
<li class="right" >
<a href="column.html" title="Column"
accesskey="P">previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
@@ -200,7 +200,7 @@
<li class="right" >
<a href="column.html" title="Column"
>previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
View
68 docs/_build/html/api/option.html
@@ -5,23 +5,22 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Option &mdash; SchemaObject v0.5 documentation</title>
+ <title>Option &mdash; SchemaObject v0.5.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
- VERSION: '0.5',
+ VERSION: '0.5.1',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
- <link rel="top" title="SchemaObject v0.5 documentation" href="../index.html" />
- <link rel="next" title="Schema (MySQL Instance)" href="schema.html" />
- <link rel="prev" title="Index" href="index.html" />
+ <link rel="top" title="SchemaObject v0.5.1 documentation" href="../index.html" />
+ <link rel="prev" title="Foreign Key" href="foreignkey.html" />
</head>
<body>
<div class="related">
@@ -34,12 +33,9 @@
<a href="../modindex.html" title="Global Module Index"
accesskey="M">modules</a> |</li>
<li class="right" >
- <a href="schema.html" title="Schema (MySQL Instance)"
- accesskey="N">next</a> |</li>
- <li class="right" >
- <a href="index.html" title="Index"
+ <a href="foreignkey.html" title="Foreign Key"
accesskey="P">previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
@@ -48,8 +44,42 @@
<div class="bodywrapper">
<div class="body">
- <div class="section" id="option">
-<h1>Option<a class="headerlink" href="#option" title="Permalink to this headline">¶</a></h1>
+ <div class="section" id="module-schemaobject.option">
+<h1>Option<a class="headerlink" href="#module-schemaobject.option" title="Permalink to this headline">¶</a></h1>
+<dl class="class">
+<dt id="schemaobject.option.SchemaOption">
+<em class="property">class </em><tt class="descclassname">schemaobject.option.</tt><tt class="descname">SchemaOption</tt><big>(</big><em>name</em>, <em>value=None</em><big>)</big><a class="headerlink" href="#schemaobject.option.SchemaOption" title="Permalink to this definition">¶</a></dt>
+<dd><dl class="docutils">
+<dt>Object representation of a database or table option</dt>
+<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">options</span><span class="p">[</span><span class="s">&#39;engine&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">name</span>
+<span class="go">&#39;ENGINE&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">options</span><span class="p">[</span><span class="s">&#39;engine&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span>
+<span class="go">&#39;InnoDB&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">options</span><span class="p">[</span><span class="s">&#39;engine&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">create</span><span class="p">()</span>
+<span class="go">&#39;ENGINE=InnoDB&#39;</span>
+</pre></div>
+</div>
+</dd>
+</dl>
+<dl class="method">
+<dt id="schemaobject.option.SchemaOption.create">
+<tt class="descname">create</tt><big>(</big><big>)</big><a class="headerlink" href="#schemaobject.option.SchemaOption.create" title="Permalink to this definition">¶</a></dt>
+<dd><dl class="docutils">
+<dt>Generate the SQL for this option</dt>
+<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">options</span><span class="p">[</span><span class="s">&#39;charset&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">create</span><span class="p">()</span>
+<span class="go">&#39;CHARSET=latin1&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">options</span><span class="p">[</span><span class="s">&#39;engine&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">create</span><span class="p">()</span>
+<span class="go">&#39;ENGINE=InnoDB&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">options</span><span class="p">[</span><span class="s">&#39;auto_increment&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">create</span><span class="p">()</span>
+<span class="go">&#39;AUTO_INCREMENT=1&#39;</span>
+</pre></div>
+</div>
+</dd>
+</dl>
+</dd></dl>
+
+</dd></dl>
+
</div>
@@ -59,11 +89,8 @@
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
- <p class="topless"><a href="index.html"
- title="previous chapter">Index</a></p>
- <h4>Next topic</h4>
- <p class="topless"><a href="schema.html"
- title="next chapter">Schema (MySQL Instance)</a></p>
+ <p class="topless"><a href="foreignkey.html"
+ title="previous chapter">Foreign Key</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/api/option.txt"
@@ -96,12 +123,9 @@
<a href="../modindex.html" title="Global Module Index"
>modules</a> |</li>
<li class="right" >
- <a href="schema.html" title="Schema (MySQL Instance)"
- >next</a> |</li>
- <li class="right" >
- <a href="index.html" title="Index"
+ <a href="foreignkey.html" title="Foreign Key"
>previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
View
18 docs/_build/html/api/schema.html
@@ -5,23 +5,23 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Schema (MySQL Instance) &mdash; SchemaObject v0.5 documentation</title>
+ <title>Schema (MySQL Instance) &mdash; SchemaObject v0.5.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
- VERSION: '0.5',
+ VERSION: '0.5.1',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
- <link rel="top" title="SchemaObject v0.5 documentation" href="../index.html" />
+ <link rel="top" title="SchemaObject v0.5.1 documentation" href="../index.html" />
<link rel="next" title="Database" href="database.html" />
- <link rel="prev" title="SchemaObject v0.5 documentation" href="../index.html" />
+ <link rel="prev" title="SchemaObject v0.5.1 documentation" href="../index.html" />
</head>
<body>
<div class="related">
@@ -37,9 +37,9 @@
<a href="database.html" title="Database"
accesskey="N">next</a> |</li>
<li class="right" >
- <a href="../index.html" title="SchemaObject v0.5 documentation"
+ <a href="../index.html" title="SchemaObject v0.5.1 documentation"
accesskey="P">previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
@@ -105,7 +105,7 @@
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="../index.html"
- title="previous chapter">SchemaObject v0.5 documentation</a></p>
+ title="previous chapter">SchemaObject v0.5.1 documentation</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="database.html"
title="next chapter">Database</a></p>
@@ -144,9 +144,9 @@
<a href="database.html" title="Database"
>next</a> |</li>
<li class="right" >
- <a href="../index.html" title="SchemaObject v0.5 documentation"
+ <a href="../index.html" title="SchemaObject v0.5.1 documentation"
>previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
View
199 docs/_build/html/api/table.html
@@ -5,22 +5,23 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Table &mdash; SchemaObject v0.5 documentation</title>
+ <title>Table &mdash; SchemaObject v0.5.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
- VERSION: '0.5',
+ VERSION: '0.5.1',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
- <link rel="top" title="SchemaObject v0.5 documentation" href="../index.html" />
- <link rel="prev" title="Schema (MySQL Instance)" href="schema.html" />
+ <link rel="top" title="SchemaObject v0.5.1 documentation" href="../index.html" />
+ <link rel="next" title="Column" href="column.html" />
+ <link rel="prev" title="Database" href="database.html" />
</head>
<body>
<div class="related">
@@ -33,9 +34,12 @@
<a href="../modindex.html" title="Global Module Index"
accesskey="M">modules</a> |</li>
<li class="right" >
- <a href="schema.html" title="Schema (MySQL Instance)"
+ <a href="column.html" title="Column"
+ accesskey="N">next</a> |</li>
+ <li class="right" >
+ <a href="database.html" title="Database"
accesskey="P">previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
@@ -44,8 +48,173 @@
<div class="bodywrapper">
<div class="body">
- <div class="section" id="table">
-<h1>Table<a class="headerlink" href="#table" title="Permalink to this headline">¶</a></h1>
+ <div class="section" id="module-schemaobject.table">
+<h1>Table<a class="headerlink" href="#module-schemaobject.table" title="Permalink to this headline">¶</a></h1>
+<dl class="class">
+<dt id="schemaobject.table.TableSchema">
+<em class="property">class </em><tt class="descclassname">schemaobject.table.</tt><tt class="descname">TableSchema</tt><big>(</big><em>name</em>, <em>parent</em><big>)</big><a class="headerlink" href="#schemaobject.table.TableSchema" title="Permalink to this definition">¶</a></dt>
+<dd><p>Object representation of a single table
+(as per <a class="reference external" href="http://dev.mysql.com/doc/refman/5.0/en/create-table.html">CREATE TABLE Syntax</a>).
+Supports equality and inequality comparison of TableSchema.</p>
+<p><tt class="docutils literal"><span class="pre">name</span></tt> is the column name.
+<tt class="docutils literal"><span class="pre">parent</span></tt> is an instance of DatabaseSchema</p>
+<div class="admonition note">
+<p class="first admonition-title">Note</p>
+<p class="last">TableSchema objects are automatically created for you by TableSchemaBuilder
+and loaded under <tt class="docutils literal"><span class="pre">schema.databases[name].tables</span></tt></p>
+</div>
+<div class="admonition note">
+<p class="first admonition-title">Note</p>
+<p class="last">table options <tt class="docutils literal"><span class="pre">auto_increment</span></tt>, <tt class="docutils literal"><span class="pre">comment</span></tt> are ignored in <tt class="docutils literal"><span class="pre">__eq__</span></tt>, <tt class="docutils literal"><span class="pre">__neq__</span></tt> comparisons.</p>
+</div>
+<p>Example</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
+<span class="go">[&#39;actor&#39;, &#39;address&#39;, &#39;category&#39;, &#39;city&#39;, &#39;country&#39;, &#39;customer&#39;, &#39;film&#39;,</span>
+<span class="go"> &#39;film_actor&#39;, &#39;film_category&#39;, &#39;film_text&#39;, &#39;inventory&#39;, &#39;language&#39;,</span>
+<span class="go"> &#39;payment&#39;, &#39;rental&#39;, &#39;staff&#39;, &#39;store&#39;]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">options</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
+<span class="go">[&#39;engine&#39;, &#39;charset&#39;, &#39;collation&#39;, &#39;row_format&#39;, &#39;auto_increment&#39;, &#39;create_options&#39;, &#39;comment&#39;]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">indexes</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
+<span class="go">[&#39;PRIMARY&#39;, &#39;rental_date&#39;, &#39;idx_fk_inventory_id&#39;, &#39;idx_fk_customer_id&#39;, &#39;idx_fk_staff_id&#39;]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">foreign_keys</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
+<span class="go">[&#39;fk_rental_customer&#39;, &#39;fk_rental_inventory&#39;, &#39;fk_rental_staff&#39;]</span>
+</pre></div>
+</div>
+<p>Table Attributes</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">name</span>
+<span class="go">&#39;rental&#39;</span>
+</pre></div>
+</div>
+<p>Table Options</p>
+<ul class="simple">
+<li>ENGINE == <tt class="docutils literal"><span class="pre">options['engine']</span></tt></li>
+<li>CHARSET, CHARACTER SET == <tt class="docutils literal"><span class="pre">options['charset']</span></tt></li>
+<li>COLLATE == <tt class="docutils literal"><span class="pre">options['collation']</span></tt></li>
+<li>ROW_FORMAT == <tt class="docutils literal"><span class="pre">options['row_format']</span></tt></li>
+<li>AUTO_INCREMENT == <tt class="docutils literal"><span class="pre">options['auto_increment']</span></tt></li>
+<li>CREATE_OPTIONS == <tt class="docutils literal"><span class="pre">options['create_options']</span></tt></li>
+<li>COMMENT == <tt class="docutils literal"><span class="pre">options['comment']</span></tt></li>
+</ul>
+<dl class="method">
+<dt id="schemaobject.table.TableSchema.alter">
+<tt class="descname">alter</tt><big>(</big><big>)</big><a class="headerlink" href="#schemaobject.table.TableSchema.alter" title="Permalink to this definition">¶</a></dt>
+<dd><dl class="docutils">
+<dt>Generate the SQL to alter this table</dt>
+<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">alter</span><span class="p">()</span>
+<span class="go">&#39;ALTER TABLE `rental`&#39;</span>
+</pre></div>
+</div>
+</dd>
+</dl>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="schemaobject.table.TableSchema.columns">
+<tt class="descname">columns</tt><a class="headerlink" href="#schemaobject.table.TableSchema.columns" title="Permalink to this definition">¶</a></dt>
+<dd><p>Lazily loaded dictionary of all the columns within this table. See ColumnSchema for usage</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span>
+<span class="go">7</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">columns</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
+<span class="go">[&#39;rental_id&#39;, &#39;rental_date&#39;, &#39;inventory_id&#39;, &#39;customer_id&#39;, &#39;return_date&#39;, &#39;staff_id&#39;, &#39;last_update&#39;</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="method">
+<dt id="schemaobject.table.TableSchema.create">
+<tt class="descname">create</tt><big>(</big><big>)</big><a class="headerlink" href="#schemaobject.table.TableSchema.create" title="Permalink to this definition">¶</a></dt>
+<dd><dl class="docutils">
+<dt>Generate the SQL to create a this table</dt>
+<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">create</span><span class="p">()</span>
+<span class="go">&#39;CREATE TABLE `rental` (</span>
+<span class="go">`rental_id` int(11) NOT NULL AUTO_INCREMENT,</span>
+<span class="go">`rental_date` datetime NOT NULL,</span>
+<span class="go">`inventory_id` mediumint(8) unsigned NOT NULL,</span>
+<span class="go">`customer_id` smallint(5) unsigned NOT NULL,</span>
+<span class="go">`return_date` datetime DEFAULT NULL,</span>
+<span class="go">`staff_id` tinyint(3) unsigned NOT NULL,</span>
+<span class="go">`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,</span>
+<span class="go">PRIMARY KEY (`rental_id`),</span>
+<span class="go">UNIQUE KEY `rental_date` (`rental_date`,`inventory_id`,`customer_id`),</span>
+<span class="go">KEY `idx_fk_inventory_id` (`inventory_id`),</span>
+<span class="go">KEY `idx_fk_customer_id` (`customer_id`),</span>
+<span class="go">KEY `idx_fk_staff_id` (`staff_id`),</span>
+<span class="go">CONSTRAINT `fk_rental_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE,</span>
+<span class="go">CONSTRAINT `fk_rental_inventory` FOREIGN KEY (`inventory_id`) REFERENCES `inventory` (`inventory_id`) ON UPDATE CASCADE,</span>
+<span class="go">CONSTRAINT `fk_rental_staff` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE)</span>
+<span class="go">ENGINE=InnoDB DEFAULT CHARSET=utf8;&#39;</span>
+</pre></div>
+</div>
+</dd>
+</dl>
+</dd></dl>
+
+<dl class="method">
+<dt id="schemaobject.table.TableSchema.drop">
+<tt class="descname">drop</tt><big>(</big><big>)</big><a class="headerlink" href="#schemaobject.table.TableSchema.drop" title="Permalink to this definition">¶</a></dt>
+<dd><dl class="docutils">
+<dt>Generate the SQL to drop this table</dt>
+<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">drop</span><span class="p">()</span>
+<span class="go">&#39;DROP TABLE `rental`;&#39;</span>
+</pre></div>
+</div>
+</dd>
+</dl>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="schemaobject.table.TableSchema.foreign_keys">
+<tt class="descname">foreign_keys</tt><a class="headerlink" href="#schemaobject.table.TableSchema.foreign_keys" title="Permalink to this definition">¶</a></dt>
+<dd><p>Lazily loaded dictionary of all the foreign keys within this table. See ForeignKeySchema for usage</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">foreign_keys</span><span class="p">)</span>
+<span class="go">3</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">foreign_keys</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
+<span class="go">[&#39;fk_rental_customer&#39;, &#39;fk_rental_inventory&#39;, &#39;fk_rental_staff&#39;]</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="schemaobject.table.TableSchema.indexes">
+<tt class="descname">indexes</tt><a class="headerlink" href="#schemaobject.table.TableSchema.indexes" title="Permalink to this definition">¶</a></dt>
+<dd><p>Lazily loaded dictionary of all the indexes within this table. See IndexSchema for usage</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">indexes</span><span class="p">)</span>
+<span class="go">5</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;sakila&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">&#39;rental&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">indexes</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
+<span class="go">[&#39;PRIMARY&#39;, &#39;rental_date&#39;, &#39;idx_fk_inventory_id&#39;, &#39;idx_fk_customer_id&#39;, &#39;idx_fk_staff_id&#39;]</span>
+</pre></div>
+</div>
+</dd></dl>
+
+<dl class="attribute">
+<dt id="schemaobject.table.TableSchema.options">
+<tt class="descname">options</tt><a class="headerlink" href="#schemaobject.table.TableSchema.options" title="Permalink to this definition">¶</a></dt>
+<dd><p>Dictionary of the supported MySQL table options. See OptionSchema for usage.</p>
+<ul class="simple">
+<li>ENGINE == <tt class="docutils literal"><span class="pre">options['engine']</span></tt></li>
+<li>CHARSET, CHARACTER SET == <tt class="docutils literal"><span class="pre">options['charset']</span></tt></li>
+<li>COLLATE == <tt class="docutils literal"><span class="pre">options['collation']</span></tt></li>
+<li>ROW_FORMAT == <tt class="docutils literal"><span class="pre">options['row_format']</span></tt></li>
+<li>AUTO_INCREMENT == <tt class="docutils literal"><span class="pre">options['auto_increment']</span></tt></li>
+<li>CREATE_OPTIONS == <tt class="docutils literal"><span class="pre">options['create_options']</span></tt></li>
+<li>COMMENT == <tt class="docutils literal"><span class="pre">options['comment']</span></tt></li>
+</ul>
+</dd></dl>
+
+</dd></dl>
+
+<dl class="function">
+<dt id="schemaobject.table.TableSchemaBuilder">
+<tt class="descclassname">schemaobject.table.</tt><tt class="descname">TableSchemaBuilder</tt><big>(</big><em>database</em><big>)</big><a class="headerlink" href="#schemaobject.table.TableSchemaBuilder" title="Permalink to this definition">¶</a></dt>
+<dd><p>Returns a dictionary loaded with all of the tables available in the database.
+<tt class="docutils literal"><span class="pre">database</span></tt> must be an instance of DatabaseSchema.</p>
+<div class="admonition note">
+<p class="first admonition-title">Note</p>
+<p class="last">This function is automatically called for you and set to
+<tt class="docutils literal"><span class="pre">schema.databases[name].tables</span></tt> when you create an instance of SchemaObject</p>
+</div>
+</dd></dl>
+
</div>
@@ -55,8 +224,11 @@
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
- <p class="topless"><a href="schema.html"
- title="previous chapter">Schema (MySQL Instance)</a></p>
+ <p class="topless"><a href="database.html"
+ title="previous chapter">Database</a></p>
+ <h4>Next topic</h4>
+ <p class="topless"><a href="column.html"
+ title="next chapter">Column</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/api/table.txt"
@@ -89,9 +261,12 @@
<a href="../modindex.html" title="Global Module Index"
>modules</a> |</li>
<li class="right" >
- <a href="schema.html" title="Schema (MySQL Instance)"
+ <a href="column.html" title="Column"
+ >next</a> |</li>
+ <li class="right" >
+ <a href="database.html" title="Database"
>previous</a> |</li>
- <li><a href="../index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="../index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
View
62 docs/_build/html/genindex.html
@@ -5,21 +5,21 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Index &mdash; SchemaObject v0.5 documentation</title>
+ <title>Index &mdash; SchemaObject v0.5.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
- VERSION: '0.5',
+ VERSION: '0.5.1',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
- <link rel="top" title="SchemaObject v0.5 documentation" href="index.html" />
+ <link rel="top" title="SchemaObject v0.5.1 documentation" href="index.html" />
</head>
<body>
<div class="related">
@@ -31,7 +31,7 @@
<li class="right" >
<a href="modindex.html" title="Global Module Index"
accesskey="M">modules</a> |</li>
- <li><a href="index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
@@ -43,7 +43,7 @@
<h1 id="index">Index</h1>
- <a href="#A"><strong>A</strong></a> | <a href="#C"><strong>C</strong></a> | <a href="#D"><strong>D</strong></a> | <a href="#F"><strong>F</strong></a> | <a href="#I"><strong>I</strong></a> | <a href="#O"><strong>O</strong></a> | <a href="#S"><strong>S</strong></a> | <a href="#T"><strong>T</strong></a>
+ <a href="#A"><strong>A</strong></a> | <a href="#C"><strong>C</strong></a> | <a href="#D"><strong>D</strong></a> | <a href="#F"><strong>F</strong></a> | <a href="#I"><strong>I</strong></a> | <a href="#M"><strong>M</strong></a> | <a href="#O"><strong>O</strong></a> | <a href="#S"><strong>S</strong></a> | <a href="#T"><strong>T</strong></a>
<hr />
@@ -52,17 +52,26 @@ <h2 id="A">A</h2>
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
<dl>
-<dt><a href="api/database.html#schemaobject.database.DatabaseSchema.alter">alter() (schemaobject.database.DatabaseSchema method)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="api/database.html#schemaobject.database.DatabaseSchema.alter">alter() (schemaobject.database.DatabaseSchema method)</a></dt>
+ <dd><dl>
+ <dt><a href="api/table.html#schemaobject.table.TableSchema.alter">(schemaobject.table.TableSchema method)</a></dt>
+ </dl></dd></dl></td><td width="33%" valign="top"><dl>
</dl></td></tr></table>
<h2 id="C">C</h2>
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
<dl>
-<dt><a href="api/database.html#schemaobject.database.DatabaseSchema.create">create() (schemaobject.database.DatabaseSchema method)</a></dt>
+<dt><a href="api/table.html#schemaobject.table.TableSchema.columns">columns (schemaobject.table.TableSchema attribute)</a></dt>
+<dt><a href="api/column.html#schemaobject.column.ColumnSchema">ColumnSchema (class in schemaobject.column)</a></dt>
+<dt><a href="api/column.html#schemaobject.column.ColumnSchemaBuilder">ColumnSchemaBuilder() (in module schemaobject.column)</a></dt>
+<dt><a href="api/column.html#schemaobject.column.ColumnSchema.create">create() (schemaobject.column.ColumnSchema method)</a></dt>
<dd><dl>
+ <dt><a href="api/database.html#schemaobject.database.DatabaseSchema.create">(schemaobject.database.DatabaseSchema method)</a></dt>
<dt><a href="api/foreignkey.html#schemaobject.foreignkey.ForeignKeySchema.create">(schemaobject.foreignkey.ForeignKeySchema method)</a></dt>
<dt><a href="api/index.html#schemaobject.index.IndexSchema.create">(schemaobject.index.IndexSchema method)</a></dt>
+ <dt><a href="api/option.html#schemaobject.option.SchemaOption.create">(schemaobject.option.SchemaOption method)</a></dt>
+ <dt><a href="api/table.html#schemaobject.table.TableSchema.create">(schemaobject.table.TableSchema method)</a></dt>
</dl></dd></dl></td><td width="33%" valign="top"><dl>
</dl></td></tr></table>
@@ -73,49 +82,68 @@ <h2 id="D">D</h2>
<dt><a href="api/schema.html#schemaobject.schema.SchemaObject.databases">databases (schemaobject.schema.SchemaObject attribute)</a></dt>
<dt><a href="api/database.html#schemaobject.database.DatabaseSchema">DatabaseSchema (class in schemaobject.database)</a></dt>
<dt><a href="api/database.html#schemaobject.database.DatabaseSchemaBuilder">DatabaseSchemaBuilder() (in module schemaobject.database)</a></dt>
-<dt><a href="api/database.html#schemaobject.database.DatabaseSchema.drop">drop() (schemaobject.database.DatabaseSchema method)</a></dt>
+<dt><a href="api/column.html#schemaobject.column.ColumnSchema.define">define() (schemaobject.column.ColumnSchema method)</a></dt>
+<dt><a href="api/column.html#schemaobject.column.ColumnSchema.drop">drop() (schemaobject.column.ColumnSchema method)</a></dt>
<dd><dl>
+ <dt><a href="api/database.html#schemaobject.database.DatabaseSchema.drop">(schemaobject.database.DatabaseSchema method)</a></dt>
<dt><a href="api/foreignkey.html#schemaobject.foreignkey.ForeignKeySchema.drop">(schemaobject.foreignkey.ForeignKeySchema method)</a></dt>
<dt><a href="api/index.html#schemaobject.index.IndexSchema.drop">(schemaobject.index.IndexSchema method)</a></dt>
+ <dt><a href="api/table.html#schemaobject.table.TableSchema.drop">(schemaobject.table.TableSchema method)</a></dt>
</dl></dd></dl></td><td width="33%" valign="top"><dl>
</dl></td></tr></table>
<h2 id="F">F</h2>
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
<dl>
+<dt><a href="api/table.html#schemaobject.table.TableSchema.foreign_keys">foreign_keys (schemaobject.table.TableSchema attribute)</a></dt>
<dt><a href="api/foreignkey.html#schemaobject.foreignkey.ForeignKeySchema">ForeignKeySchema (class in schemaobject.foreignkey)</a></dt>
-<dt><a href="api/foreignkey.html#schemaobject.foreignkey.ForeignKeySchemaBuilder">ForeignKeySchemaBuilder() (in module schemaobject.foreignkey)</a></dt>
+<dt><a href="api/foreignkey.html#schemaobject.foreignkey.ForeignKeySchemaBuilder">ForeignKeySchemaBuilder() (in module schemaobject.foreignkey)</a></dt></dl></td><td width="33%" valign="top"><dl>
<dt><a href="api/index.html#schemaobject.index.format_sub_part">format_sub_part() (in module schemaobject.index)</a></dt>
<dd><dl>
<dt><a href="api/index.html#schemaobject.index.IndexSchema.format_sub_part">(schemaobject.index.IndexSchema class method)</a></dt>
- </dl></dd></dl></td><td width="33%" valign="top"><dl>
+ </dl></dd>
</dl></td></tr></table>
<h2 id="I">I</h2>
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
<dl>
-<dt><a href="api/index.html#schemaobject.index.IndexSchema">IndexSchema (class in schemaobject.index)</a></dt>
-<dt><a href="api/index.html#schemaobject.index.IndexSchemaBuilder">IndexSchemaBuilder() (in module schemaobject.index)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="api/table.html#schemaobject.table.TableSchema.indexes">indexes (schemaobject.table.TableSchema attribute)</a></dt>
+<dt><a href="api/index.html#schemaobject.index.IndexSchema">IndexSchema (class in schemaobject.index)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="api/index.html#schemaobject.index.IndexSchemaBuilder">IndexSchemaBuilder() (in module schemaobject.index)</a></dt>
+</dl></td></tr></table>
+
+<h2 id="M">M</h2>
+<table width="100%" class="indextable"><tr><td width="33%" valign="top">
+<dl>
+
+<dt><a href="api/column.html#schemaobject.column.ColumnSchema.modify">modify() (schemaobject.column.ColumnSchema method)</a></dt></dl></td><td width="33%" valign="top"><dl>
</dl></td></tr></table>
<h2 id="O">O</h2>
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
<dl>
-<dt><a href="api/database.html#schemaobject.database.DatabaseSchema.options">options (schemaobject.database.DatabaseSchema attribute)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="api/database.html#schemaobject.database.DatabaseSchema.options">options (schemaobject.database.DatabaseSchema attribute)</a></dt>
+ <dd><dl>
+ <dt><a href="api/table.html#schemaobject.table.TableSchema.options">(schemaobject.table.TableSchema attribute)</a></dt>
+ </dl></dd></dl></td><td width="33%" valign="top"><dl>
</dl></td></tr></table>
<h2 id="S">S</h2>
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
<dl>
<dt><a href="api/schema.html#schemaobject.schema.SchemaObject">SchemaObject (class in schemaobject.schema)</a></dt>
+<dt><a href="api/column.html#module-schemaobject.column">schemaobject.column (module)</a></dt>
<dt><a href="api/database.html#module-schemaobject.database">schemaobject.database (module)</a></dt>
<dt><a href="api/foreignkey.html#module-schemaobject.foreignkey">schemaobject.foreignkey (module)</a></dt>
-<dt><a href="api/index.html#module-schemaobject.index">schemaobject.index (module)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="api/index.html#module-schemaobject.index">schemaobject.index (module)</a></dt>
+<dt><a href="api/option.html#module-schemaobject.option">schemaobject.option (module)</a></dt></dl></td><td width="33%" valign="top"><dl>
<dt><a href="api/schema.html#module-schemaobject.schema">schemaobject.schema (module)</a></dt>
+<dt><a href="api/table.html#module-schemaobject.table">schemaobject.table (module)</a></dt>
+<dt><a href="api/option.html#schemaobject.option.SchemaOption">SchemaOption (class in schemaobject.option)</a></dt>
<dt><a href="api/database.html#schemaobject.database.DatabaseSchema.select">select() (schemaobject.database.DatabaseSchema method)</a></dt>
<dt><a href="api/schema.html#schemaobject.schema.SchemaObject.selected">selected (schemaobject.schema.SchemaObject attribute)</a></dt>
</dl></td></tr></table>
@@ -124,7 +152,9 @@ <h2 id="T">T</h2>
<table width="100%" class="indextable"><tr><td width="33%" valign="top">
<dl>
-<dt><a href="api/database.html#schemaobject.database.DatabaseSchema.tables">tables (schemaobject.database.DatabaseSchema attribute)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="api/database.html#schemaobject.database.DatabaseSchema.tables">tables (schemaobject.database.DatabaseSchema attribute)</a></dt>
+<dt><a href="api/table.html#schemaobject.table.TableSchema">TableSchema (class in schemaobject.table)</a></dt></dl></td><td width="33%" valign="top"><dl>
+<dt><a href="api/table.html#schemaobject.table.TableSchemaBuilder">TableSchemaBuilder() (in module schemaobject.table)</a></dt>
</dl></td></tr></table>
@@ -163,7 +193,7 @@ <h2 id="T">T</h2>
<li class="right" >
<a href="modindex.html" title="Global Module Index"
>modules</a> |</li>
- <li><a href="index.html">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="index.html">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
View
126 docs/_build/html/index.html
@@ -5,21 +5,21 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>SchemaObject v0.5 documentation &mdash; SchemaObject v0.5 documentation</title>
+ <title>SchemaObject v0.5.1 documentation &mdash; SchemaObject v0.5.1 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
- VERSION: '0.5',
+ VERSION: '0.5.1',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
- <link rel="top" title="SchemaObject v0.5 documentation" href="" />
+ <link rel="top" title="SchemaObject v0.5.1 documentation" href="" />
<link rel="next" title="Schema (MySQL Instance)" href="api/schema.html" />
</head>
<body>
@@ -35,7 +35,7 @@
<li class="right" >
<a href="api/schema.html" title="Schema (MySQL Instance)"
accesskey="N">next</a> |</li>
- <li><a href="">SchemaObject v0.5 documentation</a> &raquo;</li>
+ <li><a href="">SchemaObject v0.5.1 documentation</a> &raquo;</li>
</ul>
</div>
@@ -44,44 +44,48 @@
<div class="bodywrapper">
<div class="body">
- <div class="section" id="schemaobject-v0-5-documentation">
-<h1>SchemaObject v0.5 documentation<a class="headerlink" href="#schemaobject-v0-5-documentation" title="Permalink to this headline">¶</a></h1>
-<div class="section" id="introduction">
-<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
-<p>SchemaObject creates an object representation of a MySQL schema including its databases, tables, columns, indexes, and foreign keys. It allows you to process and iterate over a MySQL schema through python object properties and methods.</p>
-<p>You can generate the SQL syntax for creating, altering and dropping any part of the schema. As of v0.5, a separate process is needed to push any generated changes to your database instance/schema.</p>
+ <div class="section" id="schemaobject-v0-5-1-documentation">
+<h1>SchemaObject v0.5.1 documentation<a class="headerlink" href="#schemaobject-v0-5-1-documentation" title="Permalink to this headline">¶</a></h1>
+<div class="section" id="introduction-and-examples">
+<h2>Introduction and Examples<a class="headerlink" href="#introduction-and-examples" title="Permalink to this headline">¶</a></h2>
+<p>SchemaObject provides a simple, easy to use Python object interface to a MySQL database schema. You can effortlessly write tools to test, validate, sync, migrate, or manage your schema as well as generate the SQL necessary to make changes to it.</p>
+<p><strong>Verify all tables are InnoDB</strong></p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">schemaobject</span>
+<span class="n">schema</span> <span class="o">=</span> <span class="n">schemaobject</span><span class="o">.</span><span class="n">SchemaObject</span><span class="p">(</span><span class="s">&#39;mysql://username:password@localhost:3306/mydb&#39;</span><span class="p">)</span>
+<span class="n">tables</span> <span class="o">=</span> <span class="n">schema</span><span class="o">.</span><span class="n">databases</span><span class="p">[</span><span class="s">&#39;mydb&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span> <span class="c">#or schema.selected.tables</span>
+<span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">:</span>
+ <span class="k">assert</span> <span class="n">tables</span><span class="p">[</span><span class="n">t</span><span class="p">]</span><span class="o">.</span><span class="n">options</span><span class="p">[</span><span class="s">&#39;engine&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span> <span class="o">==</span> <span class="s">&#39;InnoDB&#39;</span>
+</pre></div>