Package bsddb :: Module dbtables :: Class bsdTableDB
[hide private]
[frames] | no frames]

_ClassType bsdTableDB

Instance Methods [hide private]
 
__init__(filename, dbhome, create=0, truncate=0, mode=0600)
Open database name in the dbhome BerkeleyDB directory.
 
__del__(self)
 
close(self)
 
checkpoint(self, mins=0)
 
sync(self)
 
_db_print(self)
Print the database to stdout for debugging
 
CreateTable(self, table, columns)
CreateTable(table, columns) - Create a new table in the database.
 
ListTableColumns(self, table)
Return a list of columns in the given table.
 
ListTables(self)
Return a list of tables in this database.
 
CreateOrExtendTable(table, columns)
Create a new table in the database.
 
__load_column_info(self, table)
initialize the self.__tablecolumns dict
 
__new_rowid(self, table, txn)
Create a new unique row identifier
 
Insert(self, table, rowdict)
Insert(table, datadict) - Insert a new row into the table using the keys+values from rowdict as the column values.
 
Modify(self, table, conditions={}, mappings={})
Modify(table, conditions={}, mappings={}) - Modify items in rows matching 'conditions' using mapping functions in 'mappings'
 
Delete(self, table, conditions={})
Delete(table, conditions) - Delete items matching the given conditions from the table.
 
Select(self, table, columns, conditions={})
Select(table, columns, conditions) - retrieve specific row data Returns a list of row column->value mapping dictionaries.
 
__Select(self, table, columns, conditions)
__Select() - Used to implement Select and Delete (above) Returns a dictionary keyed on rowids containing dicts holding the row data for columns listed in the columns param that match the given conditions.
 
Drop(self, table)
Remove an entire table from the database
Method Details [hide private]

__init__(filename, dbhome, create=0, truncate=0, mode=0600)
(Constructor)

 

Open database name in the dbhome BerkeleyDB directory. Use keyword arguments when calling this constructor.

CreateTable(self, table, columns)

 

CreateTable(table, columns) - Create a new table in the database.

raises TableDBError if it already exists or for other DB errors.

ListTableColumns(self, table)

 

Return a list of columns in the given table. [] if the table doesn't exist.

CreateOrExtendTable(table, columns)

 

Create a new table in the database.

If a table of this name already exists, extend it to have any additional columns present in the given list as well as all of its current columns.

Modify(self, table, conditions={}, mappings={})

 
Modify(table, conditions={}, mappings={}) - Modify items in rows matching 'conditions' using mapping functions in 'mappings'

* table - the table name
* conditions - a dictionary keyed on column names containing
  a condition callable expecting the data string as an
  argument and returning a boolean.
* mappings - a dictionary keyed on column names containing a
  condition callable expecting the data string as an argument and
  returning the new string for that column.

Delete(self, table, conditions={})

 
Delete(table, conditions) - Delete items matching the given
conditions from the table.

* conditions - a dictionary keyed on column names containing
  condition functions expecting the data string as an
  argument and returning a boolean.

Select(self, table, columns, conditions={})

 
Select(table, columns, conditions) - retrieve specific row data
Returns a list of row column->value mapping dictionaries.

* columns - a list of which column data to return.  If
  columns is None, all columns will be returned.
* conditions - a dictionary keyed on column names
  containing callable conditions expecting the data string as an
  argument and returning a boolean.

__Select(self, table, columns, conditions)

 

__Select() - Used to implement Select and Delete (above) Returns a dictionary keyed on rowids containing dicts holding the row data for columns listed in the columns param that match the given conditions. * conditions is a dictionary keyed on column names containing callable conditions expecting the data string as an argument and returning a boolean.