A DBMS layer for cassandra with a test script.

File

http://dl.dropbox.com/u/10377957/DBMS%20test.tar.gz

Description

This is an implementation of the DBMS layer I wrote about in:

ThomasBoose EERD model components to Cassandra Column family's

The objective is to create a layer between a python application and a cassandra database that will handle the most trivial DBMS rules. I implemented this by introducing two system columnfamilys "deleted" and "dbms". The dbms columnfamily stores datatypes, foreignkey (reference), reverse lookups (reverse) and required field definitions. The "deleted" columnfamily stores key values of columnfamilys that are deleted. Single values are deleted by placing a tombstone in front of the value. Using this dbms layer is simple. instead of creating a pycassa ColumnFamily object and using the insert, get, get_range and remove, you call the generic functions: dbms.insert, dbms.get, dbms.get_range and dbms.remove. You need to include the name of the columnfamily as first parameter so: instead of:

  • cf_group = pycassa.ColumnFamily(pool,'DBMS','group')
  • cf_group.insert('nl.boose.admin',{'name':'Universe admin','moderator':'nl.boose.admin'})

you state:

  • dbms.insert('group', 'nl.boose.admin',{'name':'Universe admin','moderator':'nl.boose.admin'})

Install

To test this dbms.py script follow these steps:

  • Make sure you have cassandra running (version 0.6.9)
  • Make sure you have python, pycassa (version 0.3.0), hashlib and time installed on the client
  • Dateutil is included in the archive.
  • Stop cassandra (/etc/init.d/cassandra stop on ubuntu)
  • In storage-conf.xml replace 192.168.56.101 by the IP address of your cassandra server.
  • Replace the storage-conf.xml file on you cassandra server by the one in this archive
    alternatively you can add the Keyspace "DBMS" to your current storage.conf.
  • Restart cassandra
  • In dbms.py and createrepo.py, replace 192.168.56.101 by the IP address of your cassandra server.
  • Run: python createrepo.py
    This will populate your dbms repo with dbms rules.
  • Run: python driver.py
    This will demonstrate the dbms functions.
  • Let me know what you think
  • Please notify me of changes, experiments and other interest in this project.
  • Statements about implementations on more recent versions of cassandra and pycassa are also welcome
  • No labels