Richard Jones' Log: PyCon: "ATOP on BSDDB" looks like the Roundup hyperdb

Thu, 25 Mar 2004

People probably don't realise that the Roundup hyperdb (which is Atomic, Transactional, Object-Oriented and Persistent) may be used outside of Roundup the issue tracker. Utterly contrived example:

from roundup.hyperdb import String, Number, Multilink
from roundup.backends.back_bsddb import Database, Class

class config:
    DATABASE='/tmp/hyperdb_example'

db = Database(config, 'admin')
# define a simple schema
spam = Class(db, 'spam', name=String(), size=Number())
widget = Class(db, 'widget', title=String(), spam=Multilink('spam'))

# add some data
oneid = spam.create(name='one', size=1)
twoid = spam.create(name='two', size=2)
widgetid = widget.create(title='a widget', spam=[oneid, twoid])

# dumb, simple query
print widget.find(spam=oneid)
print widget.history(widgetid)

... which displays ...

['4']
[('4', <Date 2004-03-25.01:16:1.386365>, '1', 'create', {})]

And of course in the hyperdb, you've got multiple backends to choose from (anydbm, bsddb, bsddb3, metakit, sqlite, mysql and postgresql), full journalling of changes (may be turned off selectively), automatic behaviours (through detectors auditing and reacting), object querying and full-text indexing built-in.

Of course, having come up with this example, I've seen some very simple API changes that could make it even easier to use the hyperdb outside of Roundup. If there's interest, that is...

Comment by oier on Mon, 05 Apr 2004

I am interested in using hiperdb witch twisted , is this possible ?

Comment by Richard on Mon, 05 Apr 2004

I can only presume that Twisted, being asynchronous, has some fairly specific constraints on what it can use as a data store. I don't know how that works, so I can't say whether the hyperdb would be ok...

Comment by oier on Wed, 07 Apr 2004

Two more questions :

  1. Is the hiperdb threadsafe?
  2. where can i look for an example of the following features that you mentioned in the post ?
    • automatic behaviours
    • object querying

Thanks in advance

Comment by Richard on Wed, 07 Apr 2004

  1. I don't know. I'm pretty sure it is, but it depends a lot on the underlying database. I have not had a reason to look into it yet.
  2. See the Roundup customisation documentation - it has an examples section at the end.