Gerald is a general purpose toolkit for managing and deploying database schemas. Its major current use is to identify the differences between various versions of a schema.
For instance, you can use gerald to determine the differences between your development and test environments, or to integrate changes from a number of different developers into your integration database.
Gerald is designed to be used in an Agile environment, but is useful regardless of methodology.
Gerald is written in Python.
Gerald is designed from the ground up to support as many popular relational database systems as possible. Currently it will document and compare schemas from databases implemented in MySQL, Oracle and PostgreSQL. Other databases will be supported in future releases.
I wrote this module because I was looking for a cheap, alright - free, tool with the same kind of functionality as ERWin. I didn't find anything so I ended up keeping my data model in an Excel spreadsheet and wrote some scripts to generate my DDL into files. The one thing that they didn't do, though, was enable me to easily discover the differences between my model and what was deployed in the various databases we were using. So I started writing the code that became this module.
Of course, by the time it was usable the project was long finished. I carried on though, because I'll need the same functionality on my next project. As it's fun to share, I'm putting this code up on the internet for anyone to use as they see fit. It is licensed under the BSD License (see LICENSE.txt in the distribution).
Gerald can currently extract and compare schemas, and in future I'm hoping that it will expand to store them as well, taking over from my Excel spreadsheet. Given infinite time, I'd hope to expand its capabilities to the level of tools like ERwin and Oracle Designer.
svn checkout http://halfcooked.svn.sourceforge.net/svnroot/halfcooked/tags/release-0.2.2/gerald/
Gerald is written in Python and requires a DB-API module to interact with your database. In the current release we support the Oracle, MySQL and PostgreSQL databases. Because the code is designed to be modular and extensible adding support for different databases is quite simple. All it requires is new sub-classes of the generic classes in schema.py. They will need to be adapted for the data dictionary provided by the database.
To compare the same schema in two Oracle databases start an interactive session and type;
>>> import gerald
>>> first_schema = gerald.OracleSchema('first_schema', 'oracle:/[username]:[password]@[tns connection]')
>>> second_schema = gerald.OracleSchema('second_schema', 'oracle:/[2nd username]:[2nd password]@[2nd tns connection]')
>>> print first_schema.compare(second_schema)
You can display a reader friendly version of your schema like this;
>>> import gerald
>>> my_schema = gerald.MySQLSchema('schema_name', 'mysql:/[username]:[password]@[hostname]/[catalog name]')
>>> print my_schema.dump()
You can display an XML representation of your schema like this;
>>> import gerald
>>> my_schema = gerald.OracleSchema('schema_name', 'oracle:/[username]:[password]@[tns entry]')
>>> print my_schema.to_xml()
For more information on the available objects and methods, look at the module API documentation.
This is release 0.2.2 of gerald. It's still alpha code, but we are starting to get there. Having said that, I'm fairly happy with the API so I will only change it if I absolutely have to, and then with plenty of notice. The major addition in this release is the extensive unit tests. Of course you can never have too many so feel free to suggest some more. Or even better to write some and submit them as a patch.
The core function is fairly solid and will support a number of enhancements. I'm specifically thinking about, but in no particular order;
If anyone has suggestions I'm happy to hear your thoughts. Send an email to andy47@halfcooked.com