Subsections

1.4.9.4 Complicaitons with Gadfly

1.4.9.4.1 Creating a Gadfly Database

Because Gadlfy does not come with its own database management program, databases have to be created from within the Python code. Gadfly does this by using a special startup connection which actually creates the database it is connecting to. Once connected you can create tables as usual.

To create a Gadfly database named TestDB in the directory C:/TestDirectory you would use the following code:

connection = web.database.connect(
    type="gadfly",
    database="TestDB",
    dir="C:/TestDirectory",
    startup=True
)

You can then create a Cursor object and create tables as decribed later. You should finish by calling the cursor's commit() method to save your changes. Agian, this will be described later.

Warning: Once your database has been created you should always use a normal Gadfly connection (ie don't use startup=True). If you use a statup conneciton in a directory which already has a database in it you are likely to destroy the contents of that database.

1.4.9.4.2 Lack of NULL Support

Unfortunatly Gadfly lacks one very important feature. It has no support for NULL values. This means that if you set and column values to None then you will get unpredictable results but Gadfly will not rasie an Exception. THIS CAN BE VERY TRICKY TO SPOT SO YOU ARE ADVISED TO USE A DIFFERENT DATABASE.

1.4.9.4.3 FTP Transfer

Gadfly databases are are stored in files. If you are transferring these files using FTP software remember to transfer them in Binary mode rather than Text or Auto modes as the types of the files can sometimes be detected incorrectly by the FTP software. If you get strange errors with the values of certain field types this may be your problem.

See Also:

Gadfly Homepage
The Gadfly homepage has full documentation for using Gadfly and explains what Gadfly does and doesn't support. Extra features have been added to Gadfly through the use of the wrapper functions described in this module but it is helpful to understand Gadfly's limitations.

See About this document... for information on suggesting changes.