本文整理汇总了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')
示例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)
示例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)