def copytablelistschema(self, tableset): try: iTable = "" listsourceTable = listtableset( self.m_sourceSession.nominalSchema(), tableset) listdestTable = listtableset(self.m_destSession.nominalSchema(), tableset) self._checktable(listsourceTable, listdestTable) for key, value in listsourceTable.items(): iTable = key print iTable self._copytablelayout(iTable) self.m_destSession.transaction().commit() self.m_sourceSession.transaction().commit() print "copytablelistschema SUCCESS" return True except Exception, e: self.m_destSession.transaction().rollback() self.m_sourceSession.transaction().commit() raise Exception("Error in copytablelistschema method: " + str(e) + " : " + iTable) return False
def copytablelistdata(self, tablelist, rowCount=-1): try: iTable = "" tableset = [] for table in tablelist: i = 0 for parameter in table: if i == 0: tableset.append(parameter) i = i + 1 listsourceTable = listtableset( self.m_sourceSession.nominalSchema(), tableset) listdestTable = listtableset(self.m_destSession.nominalSchema(), tableset) for key, value in listsourceTable.items(): iTable = key print iTable currentCount = 0 selectionclause = "" selectionparameters = coral.AttributeList() for table in tablelist: i = 0 for parameter in table: if i == 0: table = parameter if table == iTable: if i == 1: selectionclause = parameter if i == 2: selectionparameters = parameter i = i + 1 tableexists = self._checkdata(iTable, listdestTable) if not tableexists: self._copytablelayout(iTable) self._copydatalayout(iTable, selectionclause, selectionparameters, currentCount, rowCount) self.m_destSession.transaction().commit() self.m_sourceSession.transaction().commit() print "copytablelistdata SUCCESS" return True except Exception, e: self.m_destSession.transaction().rollback() self.m_sourceSession.transaction().commit() raise Exception("Error in copytablelistdata method: " + str(e) + " : " + iTable) return False
def copytablelistdata(self,tablelist,rowCount=-1): try: iTable="" tableset=[] for table in tablelist: i=0 for parameter in table: if i==0: tableset.append(parameter) i=i+1 listsourceTable=listtableset( self.m_sourceSession.nominalSchema(),tableset ) listdestTable=listtableset( self.m_destSession.nominalSchema(),tableset ) for key,value in listsourceTable.items(): iTable = key print iTable currentCount = 0 selectionclause="" selectionparameters=coral.AttributeList() for table in tablelist: i=0 for parameter in table: if i==0: table=parameter if table==iTable: if i==1: selectionclause = parameter if i==2: selectionparameters = parameter i=i+1 tableexists = self._checkdata(iTable,listdestTable) if not tableexists: self._copytablelayout(iTable) self._copydatalayout(iTable,selectionclause,selectionparameters,currentCount,rowCount) self.m_destSession.transaction().commit() self.m_sourceSession.transaction().commit() print "copytablelistdata SUCCESS" return True except Exception, e: self.m_destSession.transaction().rollback() self.m_sourceSession.transaction().commit() raise Exception ("Error in copytablelistdata method: " + str(e) + " : "+ iTable) return False
def copytablelistschema(self,tableset ): try: iTable="" listsourceTable=listtableset( self.m_sourceSession.nominalSchema(),tableset ) listdestTable=listtableset( self.m_destSession.nominalSchema(),tableset ) self._checktable(listsourceTable,listdestTable) for key,value in listsourceTable.items(): iTable = key print iTable self._copytablelayout(iTable) self.m_destSession.transaction().commit() self.m_sourceSession.transaction().commit() print "copytablelistschema SUCCESS" return True except Exception, e: self.m_destSession.transaction().rollback() self.m_sourceSession.transaction().commit() raise Exception ("Error in copytablelistschema method: " + str(e)+" : "+iTable) return False