当前位置: 首页>>代码示例>>Python>>正文


Python CommonUtils.inventoryTableName方法代码示例

本文整理汇总了Python中CommonUtils.inventoryTableName方法的典型用法代码示例。如果您正苦于以下问题:Python CommonUtils.inventoryTableName方法的具体用法?Python CommonUtils.inventoryTableName怎么用?Python CommonUtils.inventoryTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommonUtils的用法示例。


在下文中一共展示了CommonUtils.inventoryTableName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import inventoryTableName [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: str

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import inventoryTableName [as 别名]
        The destination database must be empty. If not so, it will be cleaned implicitly. Inventory are implicitly copied as well.  
        """
        dest_transaction=self.__destsession.transaction()
        source_transaction=self.__sourcesession.transaction()
	tablelist=[]
	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
	
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:32,代码来源:DBCopy.py

示例3: copyInventory

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import inventoryTableName [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

示例4: str

# 需要导入模块: import CommonUtils [as 别名]
# 或者: from CommonUtils import inventoryTableName [as 别名]
            transaction.commit()
        except Exception, e:
            transaction.rollback()
            raise Exception, str(e)
        
    
if __name__ == "__main__":
    svc = coral.ConnectionService()
    session = svc.connect( 'sqlite_file:testentryComment.db',
                           accessMode = coral.access_Update )
    try:
        entrycomment=entryComment(session)
        print "test create entrycomment table"
        entrycomment.createEntryCommentTable()
        print "test insert one comment"
        entrycomment.insertComment(CommonUtils.inventoryTableName(),12,'comment1')
        entrycomment.insertComment(CommonUtils.treeTableName('ABCTREE'),12,'comment1')
        print "test bulk insert"
        bulkinput=[]
        bulkinput.append({'entryid':21,'tablename':CommonUtils.inventoryTableName(),'comment':'mycomment'})
        bulkinput.append({'entryid':22,'tablename':CommonUtils.inventoryTableName(),'comment':'mycomment2'})
        bulkinput.append({'entryid':23,'tablename':CommonUtils.inventoryTableName(),'comment':'mycomment3'})
        bulkinput.append({'entryid':24,'tablename':CommonUtils.inventoryTableName(),'comment':'mycomment4'})
        entrycomment.bulkinsertComments(CommonUtils.inventoryTableName(),bulkinput)
        print "test getCommentsForTable ",CommonUtils.inventoryTableName()
        results=entrycomment.getCommentsForTable(CommonUtils.inventoryTableName())
        print results
        result=entrycomment.getCommentForId(CommonUtils.inventoryTableName(),23)
        print result
        entrycomment.modifyCommentForId(CommonUtils.inventoryTableName(),23, 'mynewcomment' )
        print entrycomment.getCommentForId(CommonUtils.inventoryTableName(),23)
开发者ID:HeinerTholen,项目名称:cmssw,代码行数:33,代码来源:entryComment.py


注:本文中的CommonUtils.inventoryTableName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。