O'Reilly logo

Python Programming On Win32 by Mark Hammond, Andy Robinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Gadfly, the Pure Python Relational Database

We now step away from Microsoft APIs altogether. Gadfly is an SQL relational database written in Python by Aaron Watters. It can be found at http://www.chordate.com, and is distributed in a 200-KB Zip file, including documentation.

Gadfly gives Python programs relational database capabilities without relying on any external database engines. It offers the following features:

  • Compliance with the Python Database API

  • Total portability between platforms

  • A transaction log and recovery procedure

  • A built-in TCP/IP server mode, allowing it to serve clients on remote machines

  • Security policies to prevent accidental deletion of data

It’s not intended as a multiuser production system, and some features are missing at present, notably Null values and Date/Time variables.

Aaron previously produced both a parsing engine named kwParsing and a library of data structures, including sets, directed graphs, and dictionaries, called kjBuckets . These C extensions are part of the Gadfly package and can build an efficient and fast in-memory SQL engine. If you are interested in either how to parse SQL statements or in the low-level relational operations, Gadfly is a great package to explore. To install and set up Gadfly, perform these steps:

  1. Download the 217-KB Zip file.

  2. Unzip to a directory on the Python path.

  3. CD to the directory in a DOS prompt.

  4. Type python gfinstall.py.

  5. Create a subdirectory for a test database with MKDIR dbtest.

  6. Type python gftest.py dbtest. This ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required