def _populateSchemaFor(self, rc): """Construct all the SQL templates for database operations on <tableName> and populate the class <rowClass> with that info. """ attributes = ("rowColumns", "rowKeyColumns", "rowTableName" ) for att in attributes: if not hasattr(rc, att): raise DBError("RowClass %s must have class variable: %s" % (rc, att)) tableInfo = _TableInfo(rc) tableInfo.updateSQL = self.buildUpdateSQL(tableInfo) tableInfo.insertSQL = self.buildInsertSQL(tableInfo) tableInfo.deleteSQL = self.buildDeleteSQL(tableInfo) self.populateSchemaFor(tableInfo)
def _populate(self): """load schema data """ for rc in self.rowClasses: newDir = self.baseDir+"/"+rc.rowTableName self.tableDirs[rc.rowTableName] = newDir try: os.mkdir(newDir) except OSError, e: #print "Directory %s already exists." % newDir pass tableInfo = _TableInfo(rc) self.populateSchemaFor(tableInfo)