Part of twisted.enterprise.sqlreflector View Source View In Hierarchy
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 | Escape a string for use in an SQL statement. The default |
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 |
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 |
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. |
Method | addToCache | NOTE: Should this be recursive?! requires better container knowledge... |
Method | findInCache | Undocumented |
Method | removeFromCache | NOTE: should this be recursive!?? |
Parameters | value | a value to format as data in SQL. |
type | a key in util.dbTypeMap. |
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.
Returns: SQL that is used to contruct a rowObject class.
Returns: SQL that is used to insert a new row for a rowObject instance not created from the database.