I recently started looking at HamsterDB, a BerkeleyDB-like database system. In a nutshell, it provides simple, bare-bones key-value storage with ACID properties. It promises to be fast and small, and my initial (meager) experimentation seems to bear that out. Unlike Berkeley, it seems to choose simplicity in its API rather than providing every possible knob. Also unlike Berkeley, it’s pretty darn cheap, providing per-developer licensing with no further cost for deployment.

What I really wanted to write about, though, is Hamster’s extant but relatively weak python interface. Or, more accurately, I wanted to write about my own python wrapper for Hamster. With great fanfare, I would like to announce the initial version of APHW (Another Python HamsterDB Wrapper…thanks APSW!) It’s fairly minimal as of this writing, but it supports basic database creation, record CRUD, and some other odds and ends. I plan to add transactions and environments soon, with cursors coming later.

As is my wont, I’m writing the bindings in boost.python. The more I use it, the more I like it, and I feel like I’m getting pretty proficient. My initial approach was C++-heavy, with a lot of code in C++. I scrapped that code, though, and decided to go with a system that provides a minimal (though not too minimal) layer around Hamster’s C API, leaving as much work as possible for actual Python code. This approach works well and codes well; the main complication with it is that it requires more complex packaging (bundled python code and a DLL extension.)


, ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: