views:

80

answers:

5

I have a set of key/values (all text) that is too large to load in memory at once. I would like to interact with this data via a Python dictionary-like interface.

Does such a module already exist?

Reading key values should be efficient and values compressed on disk to save space.

Edit:

  • Ideally cross platform, but only using Linux for now
  • Needs to be thread safe
A: 

Assuming you are on a *nix platform, you are just BEGGING for tokyo-cabinet... It has a native set of ruby bindings... You can more information at 1978th.net...

LorenVS
need a Python solution to integrate with existing code
Plumo
Wow, I'm miss reading posts left right and center today... My bad
LorenVS
+2  A: 

Take a look at the shelve module. It provides dictionaries with various backing database systems include BerkleyDB and dbm.

Robert Christie
unfortunately "does not support concurrent read/write access"
Plumo
+2  A: 

ZODB

gnibbler
looks promising though is overkill for my particular use case. Is there a way to seamlessly compress the data on disk to save space?
Plumo
+1  A: 

Try bsddb(Python bindings for Berkley db)

Anurag Uniyal
A: 

ended up creating my own solution based on this existing module.

Plumo