Version 1.4.2
WiredTiger Python API

Python wrappers aroung the WiredTiger C API. More...

Classes

class  wiredtiger.Cursor
 Python wrapper around C WT_CURSOR. More...
 
class  wiredtiger.Session
 Python wrapper around C WT_SESSION. More...
 
class  wiredtiger.Connection
 Python wrapper around C WT_CONNECTION. More...
 

Functions

def wiredtiger.wiredtiger_open
 wiredtiger_open(home, config) -> int
 
def wiredtiger.wiredtiger_strerror
 wiredtiger_strerror(err) -> string
 
def wiredtiger.wiredtiger_version
 wiredtiger_version() -> string
 

Variables

 wiredtiger.WiredTigerError
 
 wiredtiger.WIREDTIGER_VERSION_MAJOR
 
 wiredtiger.WIREDTIGER_VERSION_MINOR
 
 wiredtiger.WIREDTIGER_VERSION_PATCH
 
 wiredtiger.WIREDTIGER_VERSION_STRING
 
 wiredtiger.Cursor_swigregister
 
 wiredtiger.Session_swigregister
 
 wiredtiger.Connection_swigregister
 
 wiredtiger.WT_DEADLOCK
 
 wiredtiger.WT_DUPLICATE_KEY
 
 wiredtiger.WT_ERROR
 
 wiredtiger.WT_NOTFOUND
 
 wiredtiger.WT_PANIC
 
 wiredtiger.WT_RESTART
 
 wiredtiger.WT_STAT_CONN_BLOCK_BYTE_READ
 
 wiredtiger.WT_STAT_CONN_BLOCK_BYTE_WRITE
 
 wiredtiger.WT_STAT_CONN_BLOCK_READ
 
 wiredtiger.WT_STAT_CONN_BLOCK_WRITE
 
 wiredtiger.WT_STAT_CONN_CACHE_BYTES_DIRTY
 
 wiredtiger.WT_STAT_CONN_CACHE_BYTES_INUSE
 
 wiredtiger.WT_STAT_CONN_CACHE_BYTES_MAX
 
 wiredtiger.WT_STAT_CONN_CACHE_BYTES_READ
 
 wiredtiger.WT_STAT_CONN_CACHE_BYTES_WRITE
 
 wiredtiger.WT_STAT_CONN_CACHE_EVICTION_CLEAN
 
 wiredtiger.WT_STAT_CONN_CACHE_EVICTION_DIRTY
 
 wiredtiger.WT_STAT_CONN_CACHE_EVICTION_FAIL
 
 wiredtiger.WT_STAT_CONN_CACHE_EVICTION_HAZARD
 
 wiredtiger.WT_STAT_CONN_CACHE_EVICTION_INTERNAL
 
 wiredtiger.WT_STAT_CONN_CACHE_EVICTION_SLOW
 
 wiredtiger.WT_STAT_CONN_CACHE_PAGES_DIRTY
 
 wiredtiger.WT_STAT_CONN_CACHE_PAGES_INUSE
 
 wiredtiger.WT_STAT_CONN_CACHE_READ
 
 wiredtiger.WT_STAT_CONN_CACHE_WRITE
 
 wiredtiger.WT_STAT_CONN_COND_WAIT
 
 wiredtiger.WT_STAT_CONN_FILE_OPEN
 
 wiredtiger.WT_STAT_CONN_MEMORY_ALLOCATION
 
 wiredtiger.WT_STAT_CONN_MEMORY_FREE
 
 wiredtiger.WT_STAT_CONN_READ_IO
 
 wiredtiger.WT_STAT_CONN_RWLOCK_READ
 
 wiredtiger.WT_STAT_CONN_RWLOCK_WRITE
 
 wiredtiger.WT_STAT_CONN_TXN_ANCIENT
 
 wiredtiger.WT_STAT_CONN_TXN_BEGIN
 
 wiredtiger.WT_STAT_CONN_TXN_CHECKPOINT
 
 wiredtiger.WT_STAT_CONN_TXN_COMMIT
 
 wiredtiger.WT_STAT_CONN_TXN_FAIL_CACHE
 
 wiredtiger.WT_STAT_CONN_TXN_ROLLBACK
 
 wiredtiger.WT_STAT_CONN_WRITE_IO
 
 wiredtiger.WT_STAT_DSRC_BLOCK_ALLOC
 
 wiredtiger.WT_STAT_DSRC_BLOCK_ALLOCSIZE
 
 wiredtiger.WT_STAT_DSRC_BLOCK_CHECKPOINT_SIZE
 
 wiredtiger.WT_STAT_DSRC_BLOCK_EXTENSION
 
 wiredtiger.WT_STAT_DSRC_BLOCK_FREE
 
 wiredtiger.WT_STAT_DSRC_BLOCK_MAGIC
 
 wiredtiger.WT_STAT_DSRC_BLOCK_MAJOR
 
 wiredtiger.WT_STAT_DSRC_BLOCK_MINOR
 
 wiredtiger.WT_STAT_DSRC_BLOCK_SIZE
 
 wiredtiger.WT_STAT_DSRC_BLOOM_COUNT
 
 wiredtiger.WT_STAT_DSRC_BLOOM_FALSE_POSITIVE
 
 wiredtiger.WT_STAT_DSRC_BLOOM_HIT
 
 wiredtiger.WT_STAT_DSRC_BLOOM_MISS
 
 wiredtiger.WT_STAT_DSRC_BLOOM_PAGE_EVICT
 
 wiredtiger.WT_STAT_DSRC_BLOOM_PAGE_READ
 
 wiredtiger.WT_STAT_DSRC_BLOOM_SIZE
 
 wiredtiger.WT_STAT_DSRC_BTREE_COLUMN_DELETED
 
 wiredtiger.WT_STAT_DSRC_BTREE_COLUMN_FIX
 
 wiredtiger.WT_STAT_DSRC_BTREE_COLUMN_INTERNAL
 
 wiredtiger.WT_STAT_DSRC_BTREE_COLUMN_VARIABLE
 
 wiredtiger.WT_STAT_DSRC_BTREE_COMPACT_REWRITE
 
 wiredtiger.WT_STAT_DSRC_BTREE_ENTRIES
 
 wiredtiger.WT_STAT_DSRC_BTREE_FIXED_LEN
 
 wiredtiger.WT_STAT_DSRC_BTREE_MAXIMUM_DEPTH
 
 wiredtiger.WT_STAT_DSRC_BTREE_MAXINTLITEM
 
 wiredtiger.WT_STAT_DSRC_BTREE_MAXINTLPAGE
 
 wiredtiger.WT_STAT_DSRC_BTREE_MAXLEAFITEM
 
 wiredtiger.WT_STAT_DSRC_BTREE_MAXLEAFPAGE
 
 wiredtiger.WT_STAT_DSRC_BTREE_OVERFLOW
 
 wiredtiger.WT_STAT_DSRC_BTREE_ROW_INTERNAL
 
 wiredtiger.WT_STAT_DSRC_BTREE_ROW_LEAF
 
 wiredtiger.WT_STAT_DSRC_CACHE_BYTES_READ
 
 wiredtiger.WT_STAT_DSRC_CACHE_BYTES_WRITE
 
 wiredtiger.WT_STAT_DSRC_CACHE_EVICTION_CLEAN
 
 wiredtiger.WT_STAT_DSRC_CACHE_EVICTION_DIRTY
 
 wiredtiger.WT_STAT_DSRC_CACHE_EVICTION_FAIL
 
 wiredtiger.WT_STAT_DSRC_CACHE_EVICTION_HAZARD
 
 wiredtiger.WT_STAT_DSRC_CACHE_EVICTION_INTERNAL
 
 wiredtiger.WT_STAT_DSRC_CACHE_OVERFLOW_VALUE
 
 wiredtiger.WT_STAT_DSRC_CACHE_READ
 
 wiredtiger.WT_STAT_DSRC_CACHE_READ_OVERFLOW
 
 wiredtiger.WT_STAT_DSRC_CACHE_WRITE
 
 wiredtiger.WT_STAT_DSRC_CURSOR_INSERT
 
 wiredtiger.WT_STAT_DSRC_CURSOR_INSERT_BULK
 
 wiredtiger.WT_STAT_DSRC_CURSOR_INSERT_BYTES
 
 wiredtiger.WT_STAT_DSRC_CURSOR_NEXT
 
 wiredtiger.WT_STAT_DSRC_CURSOR_PREV
 
 wiredtiger.WT_STAT_DSRC_CURSOR_REMOVE
 
 wiredtiger.WT_STAT_DSRC_CURSOR_REMOVE_BYTES
 
 wiredtiger.WT_STAT_DSRC_CURSOR_RESET
 
 wiredtiger.WT_STAT_DSRC_CURSOR_SEARCH
 
 wiredtiger.WT_STAT_DSRC_CURSOR_SEARCH_NEAR
 
 wiredtiger.WT_STAT_DSRC_CURSOR_UPDATE
 
 wiredtiger.WT_STAT_DSRC_CURSOR_UPDATE_BYTES
 
 wiredtiger.WT_STAT_DSRC_LSM_CHUNK_COUNT
 
 wiredtiger.WT_STAT_DSRC_LSM_GENERATION_MAX
 
 wiredtiger.WT_STAT_DSRC_LSM_LOOKUP_NO_BLOOM
 
 wiredtiger.WT_STAT_DSRC_REC_DICTIONARY
 
 wiredtiger.WT_STAT_DSRC_REC_OVFL_KEY
 
 wiredtiger.WT_STAT_DSRC_REC_OVFL_VALUE
 
 wiredtiger.WT_STAT_DSRC_REC_PAGE_DELETE
 
 wiredtiger.WT_STAT_DSRC_REC_PAGE_MERGE
 
 wiredtiger.WT_STAT_DSRC_REC_SPLIT_INTL
 
 wiredtiger.WT_STAT_DSRC_REC_SPLIT_LEAF
 
 wiredtiger.WT_STAT_DSRC_REC_WRITTEN
 
 wiredtiger.WT_STAT_DSRC_SESSION_COMPACT
 
 wiredtiger.WT_STAT_DSRC_TXN_UPDATE_CONFLICT
 
 wiredtiger.WT_STAT_DSRC_TXN_WRITE_CONFLICT
 

Detailed Description

Python wrappers aroung the WiredTiger C API.

Function Documentation

def wiredtiger.wiredtiger_open (   args)

wiredtiger_open(home, config) -> int

Open a connection to a database.

ret = wiredtiger_open(home, NULL, "create,cache_size=500M", &conn);
Parameters
homeThe path to the database home directory. See Database Home Directory for more information.
errhandlerAn error handler. If NULL, a builtin error handler is installed that writes error messages to stderr
configConfiguration string, see Configuration Strings. Permitted values:
NameEffectValues
buffer_alignmentin-memory alignment (in bytes) for buffers used for I/O. The default value of -1 indicates that a platform-specific alignment value should be used (512 bytes on Linux systems, zero elsewhere).an integer between -1 and 1MB; default -1.
cache_sizemaximum heap memory to allocate for the cache. A database should configure either a cache_size or a shared_cache not both.an integer between 1MB and 10TB; default 100MB.
createcreate the database if it does not exist.a boolean flag; default false.
direct_ioUse O_DIRECT to access files. Options are given as a list, such as "direct_io=[data]".a list, with values chosen from the following options: "data", "log"; default empty.
error_prefixprefix string for error messages.a string; default empty.
eviction_dirty_targetcontinue evicting until the cache has less dirty pages than this (as a percentage). Dirty pages will only be evicted if the cache is full enough to trigger eviction.an integer between 10 and 99; default 80.
eviction_targetcontinue evicting until the cache becomes less full than this (as a percentage). Must be less than eviction_trigger.an integer between 10 and 99; default 80.
eviction_triggertrigger eviction when the cache becomes this full (as a percentage).an integer between 10 and 99; default 95.
extensionslist of shared library extensions to load (using dlopen). Optional values are passed as the config parameter to WT_CONNECTION::load_extension. Complex paths may require quoting, for example, extensions=("/path/ext.so"="entry=my_entry").a list of strings; default empty.
hazard_maxmaximum number of simultaneous hazard pointers per session handle.an integer greater than or equal to 15; default 1000.
loggingenable logging.a boolean flag; default false.
lsm_mergemerge LSM chunks where possible.a boolean flag; default true.
multiprocesspermit sharing between processes (will automatically start an RPC server for primary processes and use RPC for secondary processes). Not yet supported in WiredTiger.a boolean flag; default false.
session_maxmaximum expected number of sessions (including server threads).an integer greater than or equal to 1; default 50.
shared_cache = (shared cache configuration options. A database should configure either a cache_size or a shared_cache not both.a set of related configuration options defined below.
    chunkthe granularity that a shared cache is redistributed.an integer between 1MB and 10TB; default 10MB.
    minminimum amount of cache a database in a shared cache can have.an integer between 10MB and 10TB; default 50MB.
    namename of a cache that is shared between databases.a string; default empty.
    sizemaximum memory to allocate for the shared cache. Setting this will update the value if one is already set.an integer between 1MB and 10TB; default 500MB.
)
syncflush files to stable storage when closing or writing checkpoints.a boolean flag; default true.
transactionalsupport transactional semantics.a boolean flag; default true.
use_environment_privuse the WIREDTIGER_CONFIG and WIREDTIGER_HOME environment variables regardless of whether or not the process is running with special privileges. See Database Home Directory for more information.a boolean flag; default false.
verboseenable messages for various events. Options are given as a list, such as "verbose=[evictserver,read]".a list, with values chosen from the following options: "block", "shared_cache", "ckpt", "evict", "evictserver", "fileops", "hazard", "lsm", "mutex", "read", "readserver", "reconcile", "salvage", "verify", "write"; default empty.
Additionally, if a file named WiredTiger.config appears in the WiredTiger home directory, it is read for configuration values (see WiredTiger.config file for details). Configuration values specified in the config argument to the wiredtiger_open function override configuration values specified in the WiredTiger.config file.
connectionpA pointer to the newly opened connection handle
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.

def wiredtiger.wiredtiger_strerror (   args)

wiredtiger_strerror(err) -> string

Return information about an error as a string; wiredtiger_strerror is a superset of the ISO C99/POSIX 1003.1-2001 function strerror.

const char *key = "non-existent key";
cursor->set_key(cursor, key);
if ((ret = cursor->remove(cursor)) != 0) {
fprintf(stderr,
"cursor.remove: %s\n", wiredtiger_strerror(ret));
return (ret);
}
Parameters
erra return value from a WiredTiger, C library or POSIX function
Returns
a string representation of the error

def wiredtiger.wiredtiger_version ( )

wiredtiger_version() -> string

Get version information.

printf("WiredTiger version %s\n", wiredtiger_version(NULL, NULL, NULL));
int major, minor, patch;
(void)wiredtiger_version(&major, &minor, &patch);
printf("WiredTiger version is %d, %d (patch %d)\n",
major, minor, patch);
Parameters
majorpa location where the major version number is returned
minorpa location where the minor version number is returned
patchpa location where the patch version number is returned
Returns
a string representation of the version