ASPN ActiveState Programmer Network
  ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups | Web Services
SEARCH
advanced | search help

Reference
ActivePython 2.4
Python Documentation
Library Reference
7. Optional Operating System Services
7.1 signal -- Set handlers for asynchronous events
7.2 socket -- Low-level networking interface
7.3 select -- Waiting for I/O completion
7.4 thread -- Multiple threads of control
7.5 threading -- Higher-level threading interface
7.6 dummy thread -- Drop-in replacement for the thread module
7.7 dummy threading -- Drop-in replacement for the threading module
7.8 Queue -- A synchronized queue class
7.9 mmap -- Memory-mapped file support
7.10 anydbm -- Generic access to DBM-style databases
7.11 dbhash -- DBM-style interface to the BSD database library
7.12 whichdb -- Guess which DBM module created a database
7.13 bsddb -- Interface to Berkeley DB library
7.13.1 Hash, BTree and Record Objects
7.14 dumbdbm -- Portable DBM implementation
7.15 zlib -- Compression compatible with gzip
7.16 gzip -- Support for gzip files
7.17 bz2 -- Compression compatible with bzip2
7.18 zipfile -- Work with ZIP archives
7.19 tarfile -- Read and write tar archive files
7.20 readline -- GNU readline interface
7.21 rlcompleter -- Completion function for GNU readline

MyASPN >> Reference >> ActivePython 2.4 >> Python Documentation >> Library Reference >> 7. Optional Operating System Services
ActivePython 2.4 documentation

7.13 bsddb -- Interface to Berkeley DB library

Availability: Unix, Windows.

The bsddb module provides an interface to the Berkeley DB library. Users can create hash, btree or record based library files using the appropriate open call. Bsddb objects behave generally like dictionaries. Keys and values must be strings, however, so to use other objects as keys or to store other kinds of objects the user must serialize them somehow, typically using marshal.dumps or pickle.dumps.

Starting with Python 2.3 the bsddb module requires the Berkeley DB library version 3.2 or later (it is known to work with 3.2 through 4.3 at the time of this writing).

See Also:

http://pybsddb.sourceforge.net/
Website with documentation for the new Python Berkeley DB interface that closely mirrors the object oriented interface provided in Berkeley DB 3 and 4.

http://www.oracle.com/database/berkeley-db/
The Berkeley DB library.

The following is a description of the legacy bsddb interface compatible with the old Python bsddb module. For details about the more modern Db and DbEnv object oriented interface see the above mentioned pybsddb URL.

The bsddb module defines the following functions that create objects that access the appropriate type of Berkeley DB file. The first two arguments of each function are the same. For ease of portability, only the first two arguments should be used in most instances.

hashopen( filename[, flag[, mode[, bsize[, ffactor[, nelem[, cachesize[, hash[, lorder]]]]]]]])
Open the hash format file named filename. Files never intended to be preserved on disk may be created by passing None as the filename. The optional flag identifies the mode used to open the file. It may be "r" (read only), "w" (read-write) , "c" (read-write - create if necessary; the default) or "n" (read-write - truncate to zero length). The other arguments are rarely used and are just passed to the low-level dbopen() function. Consult the Berkeley DB documentation for their use and interpretation.

btopen( filename[, flag[, mode[, btflags[, cachesize[, maxkeypage[, minkeypage[, pgsize[, lorder]]]]]]]])

Open the btree format file named filename. Files never intended to be preserved on disk may be created by passing None as the filename. The optional flag identifies the mode used to open the file. It may be "r" (read only), "w" (read-write), "c" (read-write - create if necessary; the default) or "n" (read-write - truncate to zero length). The other arguments are rarely used and are just passed to the low-level dbopen function. Consult the Berkeley DB documentation for their use and interpretation.

rnopen( filename[, flag[, mode[, rnflags[, cachesize[, pgsize[, lorder[, reclen[, bval[, bfname]]]]]]]]])

Open a DB record format file named filename. Files never intended to be preserved on disk may be created by passing None as the filename. The optional flag identifies the mode used to open the file. It may be "r" (read only), "w" (read-write), "c" (read-write - create if necessary; the default) or "n" (read-write - truncate to zero length). The other arguments are rarely used and are just passed to the low-level dbopen function. Consult the Berkeley DB documentation for their use and interpretation.

Note: Beginning in 2.3 some Unix versions of Python may have a bsddb185 module. This is present only to allow backwards compatibility with systems which ship with the old Berkeley DB 1.85 database library. The bsddb185 module should never be used directly in new code.

See Also:

Module dbhash:
DBM-style interface to the bsddb.



See About this document... for information on suggesting changes.

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState 2004 All rights reserved