當前位置: 首頁>>代碼示例>>Python>>正文


Python CommonUtils.inventoryIDTableName方法代碼示例

本文整理匯總了Python中CommonUtils.inventoryIDTableName方法的典型用法代碼示例。如果您正苦於以下問題:Python CommonUtils.inventoryIDTableName方法的具體用法?Python CommonUtils.inventoryIDTableName怎麽用?Python CommonUtils.inventoryIDTableName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CommonUtils的用法示例。


在下文中一共展示了CommonUtils.inventoryIDTableName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import CommonUtils [as 別名]
# 或者: from CommonUtils import inventoryIDTableName [as 別名]
 def __init__( self , session ):
     """Input: coral session handle
     """
     self.__session = session
     self.__tagInventoryTableName=CommonUtils.inventoryTableName()
     self.__tagInventoryIDName=CommonUtils.inventoryIDTableName()
     self.__tagInventoryTableColumns = {'tagid':'unsigned long', 'tagname':'string', 'pfn':'string','recordname':'string', 'objectname':'string', 'labelname':'string'}
     self.__tagInventoryTableNotNullColumns = ['tagname','pfn','recordname','objectname']
     #self.__tagInventoryTableUniqueColumns = ['tagname']
     self.__tagInventoryTablePK = ('tagid')
開發者ID:HeinerTholen,項目名稱:cmssw,代碼行數:12,代碼來源:tagInventory.py

示例2: copyInventory

# 需要導入模塊: import CommonUtils [as 別名]
# 或者: from CommonUtils import inventoryIDTableName [as 別名]
    def copyInventory( self ):
        """copy entire inventory. The original inventory in the source db will be wiped.
	"""
        inv=tagInventory.tagInventory(self.__destsession)
        inv.createInventoryTable()
        dest_transaction=self.__destsession.transaction()
        source_transaction=self.__sourcesession.transaction()
        try:
	    dest_transaction.start(False)
            #copy inventory table
            data=coral.AttributeList()
            my_editor=self.__destsession.nominalSchema().tableHandle(CommonUtils.inventoryTableName()).dataEditor()
            source_transaction.start(True)
            source_query=self.__sourcesession.nominalSchema().tableHandle(CommonUtils.inventoryTableName()).newQuery()
            conditionData=coral.AttributeList()
            source_query.setCondition('',conditionData)
            source_query.setRowCacheSize(self.__rowcachesize)
            my_editor.rowBuffer(data)
            source_query.defineOutput(data)
            bulkOperation=my_editor.bulkInsert(data,self.__rowcachesize)
            cursor=source_query.execute()
            while (cursor.next() ):
                bulkOperation.processNextIteration()
            bulkOperation.flush()
            del bulkOperation
            del source_query

            #copy inventory id table
            source_query=self.__sourcesession.nominalSchema().tableHandle(CommonUtils.inventoryIDTableName()).newQuery()
            my_ideditor=self.__destsession.nominalSchema().tableHandle(CommonUtils.inventoryIDTableName()).dataEditor()
            iddata=coral.AttributeList()            
            source_query.setCondition('',conditionData)
            source_query.setRowCacheSize(self.__rowcachesize)
            my_ideditor.rowBuffer(iddata)
            source_query.defineOutput(iddata)
            bulkOperation=my_ideditor.bulkInsert(iddata,self.__rowcachesize)
            cursor=source_query.execute()
            while cursor.next():
                bulkOperation.processNextIteration()
            bulkOperation.flush()
            del bulkOperation
            del source_query

            #copy comment table if exists
            if self.__sourcesession.nominalSchema().existsTable(CommonUtils.commentTableName()):
                source_query=self.__sourcesession.nominalSchema().tableHandle(CommonUtils.commentTableName()).newQuery()
                my_commenteditor=self.__destsession.nominalSchema().tableHandle(CommonUtils.commentTableName()).dataEditor()
                commentdata=coral.AttributeList()
                qcondition=coral.AttributeList()
                qcondition.extend('tablename','string')
                qcondition['tablename'].setData(CommonUtils.commentTableName())
                source_query.setCondition('tablename = :tablename',qcondition)
                source_query.setRowCacheSize(self.__rowcachesize)
                my_commenteditor.rowBuffer(commentdata)
                source_query.defineOutput(commentdata)
                bulkOperation=my_commenteditor.bulkInsert(commentdata,self.__rowcachesize)
                cursor=source_query.execute()
                while cursor.next():
                    bulkOperation.processNextIteration()
                bulkOperation.flush()
                del bulkOperation
                del source_query
            
            source_transaction.commit()
            dest_transaction.commit()
        except Exception, e:
            source_transaction.rollback()
            dest_transaction.rollback()
            raise Exception, str(e)
開發者ID:HeinerTholen,項目名稱:cmssw,代碼行數:71,代碼來源:DBCopy.py

示例3: str

# 需要導入模塊: import CommonUtils [as 別名]
# 或者: from CommonUtils import inventoryIDTableName [as 別名]
	alltablelist=[]
	trees=[]
        try:
           source_transaction.start(True)
	   tablelist=list(self.__sourcesession.nominalSchema().listTables())
	   source_transaction.commit()
	except Exception, e:
	   source_transaction.rollback()
	   raise Exception, str(e)
	try:
	   i = tablelist.index(CommonUtils.inventoryTableName())
	   alltablelist.append(CommonUtils.inventoryTableName())
	except ValueError:
	   raise 'Error: '+CommonUtils.inventoryTableName()+' does not exist in the source'
	try:
	   i = tablelist.index(CommonUtils.inventoryIDTableName())
	   alltablelist.append(CommonUtils.inventoryIDTableName())
	except ValueError:
	   raise 'Error: '+CommonUtils.inventoryIDTableName()+' does not exist'

	try:
	   i = tablelist.index(CommonUtils.commentTableName())
	   alltablelist.append(CommonUtils.commentTableName())
	except ValueError:
           pass
	
	for tablename in tablelist:
	   posbeg=tablename.find('TAGTREE_TABLE_')
	   if posbeg != -1:
	      treename=tablename[posbeg+len('TAGTREE_TABLE_'):]
              trees.append(treename)
開發者ID:HeinerTholen,項目名稱:cmssw,代碼行數:33,代碼來源:DBCopy.py


注:本文中的CommonUtils.inventoryIDTableName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。