t.e.s.SQLReflector(reflector.Reflector) : class documentation

Part of twisted.enterprise.sqlreflector View Source View In Hierarchy

DEPRECATED.

I reflect on a database and load RowObjects from it.

In order to do this, I interrogate a relational database to extract schema information and interface with RowObject class objects that can interact with specific tables.
Method __init__ Initialize me against a database.
Method escape_string No summary
Method quote_value Format a value for use in an SQL statement.
Method loadObjectsFrom Load a set of RowObjects from a database.
Method findTypeFor Undocumented
Method buildUpdateSQL (Internal) Build SQL template to update a RowObject.
Method buildInsertSQL (Internal) Build SQL template to insert a new row.
Method buildDeleteSQL Build the SQL template to delete a row from the table.
Method updateRowSQL Build SQL to update the contents of rowObject.
Method updateRow Update the contents of rowObject to the database.
Method insertRowSQL Build SQL to insert the contents of rowObject.
Method insertRow Insert a new row for rowObject.
Method deleteRowSQL Build SQL to delete rowObject from the database.
Method deleteRow Delete the row for rowObject from the database.
Method _populate Implement me to populate schema information for the reflector.
Method _transPopulateSchema Used to construct the row classes in a single interaction.
Method _populateSchemaFor Construct all the SQL templates for database operations on <tableName> and populate the class <rowClass> with that info.
Method _rowLoader immediate loading of rowobjects from the table with the whereClause.

Inherited from Reflector:

Method __getstate__ Undocumented
Method __setstate__ Undocumented
Method populateSchemaFor This is called once for each registered rowClass to add it and its foreign key relationships for that rowClass to the schema.
Method getTableInfo Get a TableInfo record about a particular instance.
Method buildWhereClause util method used by reflectors. builds a where clause to link a row to another table.
Method addToParent util method used by reflectors. adds these rows to the parent row object. If a rowClass does not have a containerMethod, then a list attribute "childRows" will be used.
Method addToCache NOTE: Should this be recursive?! requires better container knowledge...
Method findInCache Undocumented
Method removeFromCache NOTE: should this be recursive!??
def __init__(self, dbpool, rowClasses): (source)
Initialize me against a database.
def _populate(self): (source)
Implement me to populate schema information for the reflector.
def _transPopulateSchema(self): (source)
Used to construct the row classes in a single interaction.
def _populateSchemaFor(self, rc): (source)
Construct all the SQL templates for database operations on <tableName> and populate the class <rowClass> with that info.
def escape_string(self, text): (source)
Escape a string for use in an SQL statement. The default implementation escapes ' with '' and \ with \. Redefine this function in a subclass if your database server uses different escaping rules.
def quote_value(self, value, type): (source)
Format a value for use in an SQL statement.
Parametersvaluea value to format as data in SQL.
typea key in util.dbTypeMap.
def loadObjectsFrom(self, tableName, parentRow=None, data=None, whereClause=None, forceChildren=0): (source)

Load a set of RowObjects from a database.

Create a set of python objects of <rowClass> from the contents of a table populated with appropriate data members. Example:
 |  class EmployeeRow(row.RowObject):
 |      pass
 |
 |  def gotEmployees(employees):
 |      for emp in employees:
 |          emp.manager = "fred smith"
 |          manager.updateRow(emp)
 |
 |  reflector.loadObjectsFrom("employee",
 |                          data = userData,
 |                          whereClause = [("manager" , EQUAL, "fred smith")]
 |                          ).addCallback(gotEmployees)
NOTE: the objects and all children should be loaded in a single transaction. NOTE: can specify a parentRow _OR_ a whereClause.
def _rowLoader(self, transaction, tableName, parentRow, data, whereClause, forceChildren): (source)
immediate loading of rowobjects from the table with the whereClause.
def findTypeFor(self, tableName, columnName): (source)
Undocumented
def buildUpdateSQL(self, tableInfo): (source)

(Internal) Build SQL template to update a RowObject.

Returns: SQL that is used to contruct a rowObject class.
def buildInsertSQL(self, tableInfo): (source)

(Internal) Build SQL template to insert a new row.

Returns: SQL that is used to insert a new row for a rowObject instance not created from the database.
def buildDeleteSQL(self, tableInfo): (source)
Build the SQL template to delete a row from the table.
def updateRowSQL(self, rowObject): (source)
Build SQL to update the contents of rowObject.
def updateRow(self, rowObject): (source)
Update the contents of rowObject to the database.
def insertRowSQL(self, rowObject): (source)
Build SQL to insert the contents of rowObject.
def insertRow(self, rowObject): (source)
Insert a new row for rowObject.
def deleteRowSQL(self, rowObject): (source)
Build SQL to delete rowObject from the database.
def deleteRow(self, rowObject): (source)
Delete the row for rowObject from the database.
API Documentation for Twisted, generated by pydoctor at 2011-10-27 15:57:47.