Table Of Contents

Previous topic

Gerald Schema API

Next topic

Contributing to Gerald

This Page

Adding Support for a Database Engine


Gerald currently supports a number of popular relational databases. The code has been developed in a way that makes it possible to add support for different relational databases.

Adding support for a new database to Gerald is possible, it isn’t as simple as I would like, but is possible. The code is organised in a hierarchy of modules;:

With each database catered for by a separate module. To support a new database you simply need to create a new module and add the appropriate classes and methods to it.

Creating a New Module

To add support for a different type of database follow these steps;

  1. Check out the latest code from Subversion using;:

    $ svn checkout halfcooked
  2. cd to the code directory (halfcooked/gerald)

  3. Take a copy of either, or and call it <new db name> (e.g.

  4. Open up <new db name> in your favourite editor and take a look to familiarise yourself with the code.

    There should be a number of classes in this module that each inherit from a class with the same name in Keeping the names consistent is just a convention in the code, it isn’t enforced in any way.

    At the very least you will need implementations of the Schema and Table classes. Most modern databases will also need View, Trigger and CodeObject.

  5. Before you make any code changes modify the doc string at the top of the module as well as the __author__, __date__ and __version__ attributes just below it.

  6. Replace the _get_xxx methods of any classes in the module. You’ll notice that has fairly rudimentary support for the different types of objects you will find in a database whereas covers more possibilities. Its probably best to start with the MySQL sample as this will be easier to adapt, you can then implement other object types as and when you need them. I’ve documented the attributes each class should have (which should be populated in the _get_xxx method) in the class super types in and in Gerald Schema API.

Supported Databases

Gerald currently supports Oracle, MySQL, and PostgreSQL.

Author:Andy Todd
Last Updated:Tuesday the 8th of June, 2010.