1 :mod:`dumbdbm` --- Portable DBM implementation
2 ==============================================
5 :synopsis: Portable implementation of the simple DBM interface.
8 The :mod:`dumbdbm` module has been renamed to :mod:`dbm.dumb` in Python 3.0.
9 The :term:`2to3` tool will automatically adapt imports when converting your
12 .. index:: single: databases
16 The :mod:`dumbdbm` module is intended as a last resort fallback for the
17 :mod:`anydbm` module when no more robust module is available. The :mod:`dumbdbm`
18 module is not written for speed and is not nearly as heavily used as the other
21 The :mod:`dumbdbm` module provides a persistent dictionary-like interface which
22 is written entirely in Python. Unlike other modules such as :mod:`gdbm` and
23 :mod:`bsddb`, no external library is required. As with other persistent
24 mappings, the keys and values must always be strings.
26 The module defines the following:
31 Raised on dumbdbm-specific errors, such as I/O errors. :exc:`KeyError` is
32 raised for general mapping errors like specifying an incorrect key.
35 .. function:: open(filename[, flag[, mode]])
37 Open a dumbdbm database and return a dumbdbm object. The *filename* argument is
38 the basename of the database file (without any specific extensions). When a
39 dumbdbm database is created, files with :file:`.dat` and :file:`.dir` extensions
42 The optional *flag* argument is currently ignored; the database is always opened
43 for update, and will be created if it does not exist.
45 The optional *mode* argument is the Unix mode of the file, used only when the
46 database has to be created. It defaults to octal ``0666`` (and will be modified
47 by the prevailing umask).
49 .. versionchanged:: 2.2
50 The *mode* argument was ignored in earlier versions.
56 Generic interface to ``dbm``\ -style databases.
59 Similar interface to the DBM/NDBM library.
62 Similar interface to the GNU GDBM library.
65 Persistence module which stores non-string data.
68 Utility module used to determine the type of an existing database.
76 In addition to the methods provided by the :class:`UserDict.DictMixin` class,
77 :class:`dumbdbm` objects provide the following methods.
80 .. method:: dumbdbm.sync()
82 Synchronize the on-disk directory and data files. This method is called by the
83 :meth:`sync` method of :class:`Shelve` objects.