Class t.e.s.SQLReflector(reflector.Reflector):

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.

Split Table into Classes Show Methods in One Table

Line # Kind Name Docs
31 Method __init__ Initialize me against a database.
65 Method escape_string Escape a string for use in an SQL statement. The default
73 Method quote_value Format a value for use in an SQL statement.
81 Method loadObjectsFrom Load a set of RowObjects from a database.
191 Method findTypeFor Undocumented
198 Method buildUpdateSQL (Internal) Build SQL template to update a RowObject.
224 Method buildInsertSQL (Internal) Build SQL template to insert a new row.
252 Method buildDeleteSQL Build the SQL template to delete a row from the table.
266 Method updateRowSQL Build SQL to update the contents of rowObject.
283 Method updateRow Update the contents of rowObject to the database.
290 Method insertRowSQL Build SQL to insert the contents of rowObject.
300 Method insertRow Insert a new row for rowObject.
307 Method deleteRowSQL Build SQL to delete rowObject from the database.
319 Method deleteRow Delete the row for rowObject from the database.
37 Method _populate Implement me to populate schema information for the reflector.
40 Method _transPopulateSchema Used to construct the row classes in a single interaction.
50 Method _populateSchemaFor Construct all the SQL templates for database operations on
120 Method _rowLoader immediate loading of rowobjects from the table with the whereClause.

Inherited from Reflector:

Line # Kind Name Docs
33 Method __getstate__ Undocumented
38 Method __setstate__ Undocumented
48 Method populateSchemaFor This is called once for each registered rowClass to add it
61 Method getTableInfo Get a TableInfo record about a particular instance.
78 Method buildWhereClause util method used by reflectors. builds a where clause to link a row to another table.
87 Method addToParent util method used by reflectors. adds these rows to the parent row object.
115 Method addToCache NOTE: Should this be recursive?! requires better container knowledge...
119 Method findInCache Undocumented
127 Method removeFromCache NOTE: should this be recursive!??
Line # Kind Name Docs
33 Method __getstate__ Undocumented
31 Method __init__ Initialize me against a database.
38 Method __setstate__ Undocumented
115 Method addToCache NOTE: Should this be recursive?! requires better container knowledge...
87 Method addToParent util method used by reflectors. adds these rows to the parent row object.
252 Method buildDeleteSQL Build the SQL template to delete a row from the table.
224 Method buildInsertSQL (Internal) Build SQL template to insert a new row.
198 Method buildUpdateSQL (Internal) Build SQL template to update a RowObject.
78 Method buildWhereClause util method used by reflectors. builds a where clause to link a row to another table.
319 Method deleteRow Delete the row for rowObject from the database.
307 Method deleteRowSQL Build SQL to delete rowObject from the database.
65 Method escape_string Escape a string for use in an SQL statement. The default
119 Method findInCache Undocumented
191 Method findTypeFor Undocumented
61 Method getTableInfo Get a TableInfo record about a particular instance.
300 Method insertRow Insert a new row for rowObject.
290 Method insertRowSQL Build SQL to insert the contents of rowObject.
81 Method loadObjectsFrom Load a set of RowObjects from a database.
48 Method populateSchemaFor This is called once for each registered rowClass to add it
73 Method quote_value Format a value for use in an SQL statement.
127 Method removeFromCache NOTE: should this be recursive!??
283 Method updateRow Update the contents of rowObject to the database.
266 Method updateRowSQL Build SQL to update the contents of rowObject.
37 Method _populate Implement me to populate schema information for the reflector.
50 Method _populateSchemaFor Construct all the SQL templates for database operations on
120 Method _rowLoader immediate loading of rowobjects from the table with the whereClause.
40 Method _transPopulateSchema Used to construct the row classes in a single interaction.
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 2008-10-26 16:12:37.