pyre.db.Server

Module Contents

class pyre.db.Server.Server

Bases: pyre.component

Abstract component that encapsulates the connection to a database back end

This class is meant to be used as the base class for back end specific component implementations. It provides a complete but trivial implementation of the {DataStore} interface.

providesHeaders = True
sql
doc = the generator of the SQL statements
createDatabase(self, name)

Build and execute the SQL statement to create the database {name}

dropDatabase(self, name)

Build and execute the SQL statement to drop the database {name}

createTable(self, table)

Build and execute the SQL statement necessary to create {table}

dropTable(self, table)

Build and execute the SQL statement necessary to delete {table} from the datastore

insert(self, *records)

Insert {records} into the database

update(self, *specifications)

Use {specifications} to update the database

Each item in {specifications} is a pair of a {template} and a {condition}. The {template} is an instance of a table row with all fields that require update having values that are not {None}. The {condition} is an expression that identifies the portion of the table that will be affected

delete(self, table, condition)

Delete all {table} records that match {condition}

select(self, query)

Execute the given {query} and return the retrieved data

__enter__(self)

Hook invoked when the context manager is entered

__exit__(self, exc_type, exc_instance, exc_traceback)

Hook invoked when the context manager’s block exits