Version 1.3.0
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_RESTART
 
 wiredtiger.WT_STAT_txn_ancient
 
 wiredtiger.WT_STAT_block_read
 
 wiredtiger.WT_STAT_block_write
 
 wiredtiger.WT_STAT_cache_bytes_inuse
 
 wiredtiger.WT_STAT_cache_evict_slow
 
 wiredtiger.WT_STAT_cache_evict_internal
 
 wiredtiger.WT_STAT_cache_bytes_max
 
 wiredtiger.WT_STAT_cache_evict_modified
 
 wiredtiger.WT_STAT_cache_pages_inuse
 
 wiredtiger.WT_STAT_cache_evict_hazard
 
 wiredtiger.WT_STAT_cache_evict_unmodified
 
 wiredtiger.WT_STAT_checkpoint
 
 wiredtiger.WT_STAT_cond_wait
 
 wiredtiger.WT_STAT_file_open
 
 wiredtiger.WT_STAT_rwlock_rdlock
 
 wiredtiger.WT_STAT_rwlock_wrlock
 
 wiredtiger.WT_STAT_memalloc
 
 wiredtiger.WT_STAT_memfree
 
 wiredtiger.WT_STAT_total_read_io
 
 wiredtiger.WT_STAT_total_write_io
 
 wiredtiger.WT_STAT_txn_begin
 
 wiredtiger.WT_STAT_txn_commit
 
 wiredtiger.WT_STAT_txn_rollback
 
 wiredtiger.WT_STAT_file_bulk_loaded
 
 wiredtiger.WT_STAT_file_col_deleted
 
 wiredtiger.WT_STAT_file_col_fix_pages
 
 wiredtiger.WT_STAT_file_col_int_pages
 
 wiredtiger.WT_STAT_file_col_var_pages
 
 wiredtiger.WT_STAT_cursor_inserts
 
 wiredtiger.WT_STAT_cursor_read
 
 wiredtiger.WT_STAT_cursor_read_near
 
 wiredtiger.WT_STAT_cursor_read_next
 
 wiredtiger.WT_STAT_cursor_read_prev
 
 wiredtiger.WT_STAT_cursor_removes
 
 wiredtiger.WT_STAT_cursor_resets
 
 wiredtiger.WT_STAT_cursor_updates
 
 wiredtiger.WT_STAT_alloc
 
 wiredtiger.WT_STAT_extend
 
 wiredtiger.WT_STAT_free
 
 wiredtiger.WT_STAT_overflow_read
 
 wiredtiger.WT_STAT_page_read
 
 wiredtiger.WT_STAT_page_write
 
 wiredtiger.WT_STAT_file_size
 
 wiredtiger.WT_STAT_file_fixed_len
 
 wiredtiger.WT_STAT_file_magic
 
 wiredtiger.WT_STAT_file_major
 
 wiredtiger.WT_STAT_file_maxintlitem
 
 wiredtiger.WT_STAT_file_maxintlpage
 
 wiredtiger.WT_STAT_file_maxleafitem
 
 wiredtiger.WT_STAT_file_maxleafpage
 
 wiredtiger.WT_STAT_file_minor
 
 wiredtiger.WT_STAT_file_overflow
 
 wiredtiger.WT_STAT_file_allocsize
 
 wiredtiger.WT_STAT_rec_page_merge
 
 wiredtiger.WT_STAT_rec_dictionary
 
 wiredtiger.WT_STAT_rec_split_intl
 
 wiredtiger.WT_STAT_rec_split_leaf
 
 wiredtiger.WT_STAT_rec_ovfl_key
 
 wiredtiger.WT_STAT_rec_ovfl_value
 
 wiredtiger.WT_STAT_rec_page_delete
 
 wiredtiger.WT_STAT_rec_written
 
 wiredtiger.WT_STAT_rec_hazard
 
 wiredtiger.WT_STAT_file_row_int_pages
 
 wiredtiger.WT_STAT_file_row_leaf_pages
 
 wiredtiger.WT_STAT_file_entries
 
 wiredtiger.WT_STAT_update_conflict
 
 wiredtiger.WT_STAT_file_write_conflicts
 

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.

const char *home = "WT_TEST";
ret = wiredtiger_open(home, NULL, "create,transactional", &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. By default, a platform-specific alignment value is 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.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_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 extensions to load. Optional values are passed as the config parameter to WT_CONNECTION::load_extension. Complex paths may need quoting, for example, extensions=("/path/to/ext.so"="entry=my_entry").a list of strings; default empty.
hazard_maxnumber of simultaneous hazard references per session handle.an integer greater than or equal to 15; default 30.
loggingenable logging.a boolean flag; default false.
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.
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", "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 = "some 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