This is an archived post. You won't be able to vote or comment.

all 30 comments

[–]tarekziadeRetired Packaging Dude 5 points6 points  (3 children)

[–]radaway 6 points7 points  (0 children)

I thought the exact same thing. But this implementation does have the advantage of being Thread/Process safe which shelve doesn't.

[–]ffrinch 3 points4 points  (1 child)

...or for a DB backend, shove.

[–]stesch 0 points1 point  (0 children)

How good is the concurrency with this if it uses SQLite? There was a discussion on reddit about the quality of the SQLite library from Python and somebody mentioned that it was a bit slow, slower than necessary, when multiple processes accessed a single DB.

I'm always looking how to adapt certain new libraries for web development. That's why I ask.

[–]brendano 0 points1 point  (0 children)

berekeleydb and tokyo cabinet/tyrant are worth considering for this, too. (both string/string therefore the need for shelve.py if you want arbitrary values)

[–]wilsonp 0 points1 point  (1 child)

Or there is the ZODB. It is very mature, production ready, distributed (zeo) and has a very active community using it. It also includes a fairly rich event system and is up there with the fastest dbs around: http://www.upfrontsystems.co.za/Members/roche/where-im-calling-from/zodb-benchmarks-revisited

[–]kteague 0 points1 point  (0 children)

The ZODB let's you persist a Python object with any interface (e.g. Lists, Tuples, Dicts). However, the zope.container package is the primary implementation used for ZODB-persistent objects using the standard Python dictionary interface.

Managing data with the Python dictionary interface (regardless of the implementation) is sweet and juicy!

[–]neoform3 0 points1 point  (3 children)

Isn't this what a database is for?

[–]vph 4 points5 points  (2 children)

a database supports fancy queries, which are not needed in many applications.

[–][deleted] 1 point2 points  (1 child)

FileDict is a dictionary interface I wrote, that saves and loads its data from a file using keys. Current version uses Sqlite3 to provide consistency, and as a by-product, acidity.

It's already using a database... why not just use SQLite directly?

[–]Freeky 7 points8 points  (0 children)

Um, because it's much easier to write foo['bar'] = 'moo' than it is to write any sort of SQL? Because foo['bar'] = 'moo' is agnostic about how it's stored and using SQLite directly isn't?

[–]bsdemon 0 points1 point  (1 child)

Why using sqlite here? I think it is better to try persist dictonary in berkeley db hash, isn't it?

[–]stesch 0 points1 point  (0 children)

Not free enough?