Skip to content
Iterate over a MySQL database schema as a Python object
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


SchemaObject v0.5.4 documentation 

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. 

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.

Download and Install

* SchemaObject has been tested against Python 2.4, 2.5, and 2.6.
* To use SchemaObject, you need to have MySQL <>, version 5.0 or higher and MySQLdb <>, version 1.2.1p2 or higher installed. 
* To run the test suite, you need to install a copy of the Sakila Database <>, version 0.8

Installing with easy_install
    sudo easy_install schemaobject

Installing the latest development version
    git clone git://
    cd schemaobject
    sudo python install

Documentation is available @
Status & License
SchemaObject is under active development and released under the Apache License, Version 2.0 <>. 

You can obtain a copy of the latest source code from the Git repository <>, or fork it on Github <>.

You can report bugs via the SchemaObject Issues page <>

Comments, questions, and feature requests can be sent to code at matuson dot com
Something went wrong with that request. Please try again.