February 2006
Intermediate to advanced
648 pages
14h 53m
English
The dbhash module is used to open databases using the bsddb module, but with an interface that closely matches the interface of the other database modules.
open(
filename
[,flag=’r’ [,
mode
])Opens a DB database and returns the database object. A database object, d, returned by open() behaves like a dictionary and also provides the following methods:
| Method | Description |
|---|---|
| d.first() | Returns the first key in the database |
| d.last() | Returns the last key in a database traversal |
| d.next(key) | Returns the next key following key in the database |
| d.previous(key) | Returns the item that comes before key in a forward traversal of the database |
| d.sync() | Writes unsaved data to the disk |
errorException raised on database errors other than KeyError. Same as bsddb.error ...