New in version 0.5.0.
Platforms: POSIX
Open the database file filename and return a corresponding object. If the database file already exists, whichdb() is used to determine its type; if it does not exist, open() will try to deduce the database type from the filename extension; if this doesn’t work, TCHDB will be used.
The optional flag argument can be:
Value | Meaning |
---|---|
'r' | Open existing database for reading only (default) |
'w' | Open existing database for reading and writing |
'c' | Open database for reading and writing, creating it if it doesn’t exist |
'n' | Always create a new, empty database, open for reading and writing |
The optional mode argument is the Unix mode of the file. It defaults to octal 0o666 (and will be modified by the prevailing umask).
The tcdbm database types are wrappers for their corresponding tokyocabinet type. In addition to their counterparts methods and attributes, they implement collections.MutableMapping and should behave, for all intents and purposes, like dict.
Wrapper for tokyocabinet.BDB.