Pickle > Shelve > Small SQL Databases

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Mon Aug 26 23:11:03 EDT 2002


chris.lyon at spritenote.co.uk (Chris Lyon) writes:
> I can see that dbhash will address the issue of tranversing the
> database but how do I use the .first ,.next .last calls from a shelve
> file?
> Or do I ignore shelve and use dbhash to store pickles of the classes?

Shelve always seemed a little weird to me, so I just store pickles or
marhsals.

If you don't have a really large number of keys of keys, just use 

   db = dbhash.open(filename)
   for k in db.keys():
      ....

That reads all the keys into memory, of course, so it's not ideal.
But it sounded like you have relatively few keys, and large objects.




More information about the Python-list mailing list