kenobiDB

class KenobiDB(__builtin__.object) Methods

__init__(self, file, auto_save=False)

Creates a database object and loads the data from the location path. If the file does not exist it will be created. Also allows you to set auto_save to True or False (default=False). If auto_save is set to True the database is written to file after every change.

all(self)

Return a list of all documents in the database.

find_all(self, key, value_list)

Return a list of documents with values including all matches from the value_list.

find_any(self, key, value_list)

Return a list of documents with values including any matches from the value_list.

insert(self, document)

Add a document (a python dict) to the database and return True.

insert_many(self, document_list)

Add a list of documents to the database and return True.

purge(self)

Remove all documents from the database, return True.

remove(self, key, value)

Remove document(s) with the matching key: value pair as key and value args given, return document(s) that were removed.

save_db(self)

Force dump the database to a file, return True.

search(self, key, value)

Return a list of documents with key: value pairs matching the given key and value args given.

update(self, id_key, id_value, new_dict)

Update a document, takes three arguments, one key and one value to find which document to update, and a dict which contains the key/value pair to be updated/ inserted. Returns True.


Written by Harrison Erd
Art by Jessica Finson Roth