Example code for anydbm wanted...
Mon Aug 4 03:23:13 CEST 2003
"John D." <lists at webcrunchers.com> writes:
> Does anyone have any good example code that shows how to use the
> "anydbm" wrapper tp interface with a very simple database. like
> some examples of how to use "dumbdbm"? Then perhaps at a later
> time, I'm going to want to then interface it to a more robust
> database like PostGreSQL or mySQL. But I want to external interface
> to "hide" the specifics and have a really generic interface.
I think using anydbm isn't wise because it makes a completely
indeterminate choice of what underlying database library to call. I
used it in a Python 1.5.2 script and later the machine it ran on had
an OS upgrade. The result was that anydbm switched to using an
incompatible dbm library and my script broke and I had to do contorted
things to get it working again. If you don't want to use particular
features of a specific dbm library (and deal with the headaches of
handling upgrades to that library), it's probably better to just use
dumbdbm. If dumbdbm's performance is really awful, then dumbdbm
should be fixed.
More information about the Python-list