CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Attributes | Private Attributes
python.DBCopy.DBCopy Class Reference
Inheritance diagram for python.DBCopy.DBCopy:

Public Member Functions

def __init__
 
def copyDB
 
def copyInventory
 
def copyTrees
 
def resetrowcachesize
 

Static Public Attributes

list alltablelist = []
 
tuple bulkOperation = dest_editor.bulkInsert(data,self.__rowcachesize)
 
tuple conditionData = coral.AttributeList()
 
tuple cursor = source_query.execute()
 
tuple data = coral.AttributeList()
 
tuple dest_editor = self.__destsession.nominalSchema()
 
tuple dest_transaction = self.__destsession.transaction()
 
tuple desttree = TagTree.tagTree(self.__destsession,treename)
 
list entries = []
 
dictionary entry = {}
 
tuple i = tablelist.index(CommonUtils.inventoryTableName())
 
tuple iddata = coral.AttributeList()
 
tuple inv = tagInventory.tagInventory(self.__destsession)
 
dictionary merged = {}
 
tuple my_editor = self.__destsession.nominalSchema()
 
tuple posbeg = tablename.find('TAGTREE_TABLE_')
 
tuple source_query = self.__sourcesession.nominalSchema()
 
tuple source_transaction = self.__sourcesession.transaction()
 
tuple sourceinv = tagInventory.tagInventory(self.__sourcesession)
 
tuple sourcetags = sourceinv.getAllEntries()
 
tuple t = TagTree.tagTree(self.__sourcesession,treename)
 
tuple tablelist = list(self.__sourcesession.nominalSchema().listTables())
 
tuple tagiddict = inv.bulkInsertEntries(entries)
 
list treename = tablename[posbeg+len('TAGTREE_TABLE_'):]
 
list trees = []
 

Private Attributes

 __sourcesession
 

Detailed Description

Definition at line 4 of file DBCopy.py.

Constructor & Destructor Documentation

def python.DBCopy.DBCopy.__init__ (   self,
  sourcesession,
  destsession,
  rowcachesize = 1024 
)

Definition at line 6 of file DBCopy.py.

6 
7  def __init__( self, sourcesession, destsession, rowcachesize=1024 ):
self.__sourcesession=sourcesession

Member Function Documentation

def python.DBCopy.DBCopy.copyDB (   self)
copy all globaltag related tables from an external source.
The destination database must be empty. If not so, it will be cleaned implicitly. Inventory are implicitly copied as well.  

Definition at line 184 of file DBCopy.py.

185  def copyDB( self ):
186  """copy all globaltag related tables from an external source.
187  The destination database must be empty. If not so, it will be cleaned implicitly. Inventory are implicitly copied as well.
188  """
189  dest_transaction=self.__destsession.transaction()
source_transaction=self.__sourcesession.transaction()
def python.DBCopy.DBCopy.copyInventory (   self)
copy entire inventory. The original inventory in the source db will be wiped.

Definition at line 14 of file DBCopy.py.

14 
15  def copyInventory( self ):
16  """copy entire inventory. The original inventory in the source db will be wiped.
17  """
18  inv=tagInventory.tagInventory(self.__destsession)
19  inv.createInventoryTable()
20  dest_transaction=self.__destsession.transaction()
21  source_transaction=self.__sourcesession.transaction()
22  try:
23  dest_transaction.start(False)
24  #copy inventory table
25  data=coral.AttributeList()
26  my_editor=self.__destsession.nominalSchema().tableHandle(CommonUtils.inventoryTableName()).dataEditor()
27  source_transaction.start(True)
28  source_query=self.__sourcesession.nominalSchema().tableHandle(CommonUtils.inventoryTableName()).newQuery()
29  conditionData=coral.AttributeList()
30  source_query.setCondition('',conditionData)
31  source_query.setRowCacheSize(self.__rowcachesize)
32  my_editor.rowBuffer(data)
33  source_query.defineOutput(data)
34  bulkOperation=my_editor.bulkInsert(data,self.__rowcachesize)
35  cursor=source_query.execute()
36  while (cursor.next() ):
37  bulkOperation.processNextIteration()
38  bulkOperation.flush()
39  del bulkOperation
40  del source_query
41 
42  #copy inventory id table
43  source_query=self.__sourcesession.nominalSchema().tableHandle(CommonUtils.inventoryIDTableName()).newQuery()
44  my_ideditor=self.__destsession.nominalSchema().tableHandle(CommonUtils.inventoryIDTableName()).dataEditor()
45  iddata=coral.AttributeList()
46  source_query.setCondition('',conditionData)
47  source_query.setRowCacheSize(self.__rowcachesize)
48  my_ideditor.rowBuffer(iddata)
49  source_query.defineOutput(iddata)
50  bulkOperation=my_ideditor.bulkInsert(iddata,self.__rowcachesize)
51  cursor=source_query.execute()
52  while cursor.next():
53  bulkOperation.processNextIteration()
54  bulkOperation.flush()
55  del bulkOperation
56  del source_query
57 
58  #copy comment table if exists
59  if self.__sourcesession.nominalSchema().existsTable(CommonUtils.commentTableName()):
60  source_query=self.__sourcesession.nominalSchema().tableHandle(CommonUtils.commentTableName()).newQuery()
61  my_commenteditor=self.__destsession.nominalSchema().tableHandle(CommonUtils.commentTableName()).dataEditor()
62  commentdata=coral.AttributeList()
63  qcondition=coral.AttributeList()
64  qcondition.extend('tablename','string')
65  qcondition['tablename'].setData(CommonUtils.commentTableName())
66  source_query.setCondition('tablename = :tablename',qcondition)
67  source_query.setRowCacheSize(self.__rowcachesize)
68  my_commenteditor.rowBuffer(commentdata)
69  source_query.defineOutput(commentdata)
70  bulkOperation=my_commenteditor.bulkInsert(commentdata,self.__rowcachesize)
71  cursor=source_query.execute()
72  while cursor.next():
73  bulkOperation.processNextIteration()
74  bulkOperation.flush()
75  del bulkOperation
76  del source_query
77 
78  source_transaction.commit()
79  dest_transaction.commit()
80  except Exception, e:
81  source_transaction.rollback()
82  dest_transaction.rollback()
83  raise Exception, str(e)
def python.DBCopy.DBCopy.copyTrees (   self,
  treenames 
)
copy tree from an external source.
    Merge inventory if existing in the destination

Definition at line 84 of file DBCopy.py.

84 
85  def copyTrees( self, treenames ):
86  """copy tree from an external source.
87  Merge inventory if existing in the destination
"""
def python.DBCopy.DBCopy.resetrowcachesize (   self,
  newrowcachesize 
)

Definition at line 11 of file DBCopy.py.

11 
def resetrowcachesize( self, newrowcachesize):

Member Data Documentation

python.DBCopy.DBCopy.__sourcesession
private

Definition at line 7 of file DBCopy.py.

list python.DBCopy.DBCopy.alltablelist = []
static

Definition at line 191 of file DBCopy.py.

tuple python.DBCopy.DBCopy.bulkOperation = dest_editor.bulkInsert(data,self.__rowcachesize)
static

Definition at line 131 of file DBCopy.py.

tuple python.DBCopy.DBCopy.conditionData = coral.AttributeList()
static

Definition at line 126 of file DBCopy.py.

tuple python.DBCopy.DBCopy.cursor = source_query.execute()
static

Definition at line 132 of file DBCopy.py.

Referenced by Vispa.Gui.MenuWidget.MenuWidget.leaveEvent(), and Vispa.Gui.ConnectableWidget.ConnectableWidget.leaveEvent().

tuple python.DBCopy.DBCopy.data = coral.AttributeList()
static

Definition at line 123 of file DBCopy.py.

Referenced by python.multivaluedict.MyUserList.__delitem__(), confdb.HLTProcess.customize(), confdb.HLTProcess.dump(), confdb.HLTProcess.getRawConfigurationFromDB(), and confdb.HLTProcess.releaseSpecificCustomize().

tuple python.DBCopy.DBCopy.dest_editor = self.__destsession.nominalSchema()
static

Definition at line 124 of file DBCopy.py.

tuple python.DBCopy.DBCopy.dest_transaction = self.__destsession.transaction()
static

Definition at line 113 of file DBCopy.py.

tuple python.DBCopy.DBCopy.desttree = TagTree.tagTree(self.__destsession,treename)
static

Definition at line 118 of file DBCopy.py.

list python.DBCopy.DBCopy.entries = []
static

Definition at line 99 of file DBCopy.py.

Referenced by python.rootplot.utilities.Hist.__init_TGraph(), and python.rootplot.utilities.Hist.TH1F().

dictionary python.DBCopy.DBCopy.entry = {}
static

Definition at line 103 of file DBCopy.py.

tuple python.DBCopy.DBCopy.i = tablelist.index(CommonUtils.inventoryTableName())
static

Definition at line 201 of file DBCopy.py.

tuple python.DBCopy.DBCopy.iddata = coral.AttributeList()
static

Definition at line 139 of file DBCopy.py.

tuple python.DBCopy.DBCopy.inv = tagInventory.tagInventory(self.__destsession)
static

Definition at line 111 of file DBCopy.py.

dictionary python.DBCopy.DBCopy.merged = {}
static

Definition at line 93 of file DBCopy.py.

tuple python.DBCopy.DBCopy.my_editor = self.__destsession.nominalSchema()
static

Definition at line 242 of file DBCopy.py.

tuple python.DBCopy.DBCopy.posbeg = tablename.find('TAGTREE_TABLE_')
static

Definition at line 218 of file DBCopy.py.

tuple python.DBCopy.DBCopy.source_query = self.__sourcesession.nominalSchema()
static

Definition at line 125 of file DBCopy.py.

tuple python.DBCopy.DBCopy.source_transaction = self.__sourcesession.transaction()
static

Definition at line 114 of file DBCopy.py.

tuple python.DBCopy.DBCopy.sourceinv = tagInventory.tagInventory(self.__sourcesession)
static

Definition at line 97 of file DBCopy.py.

tuple python.DBCopy.DBCopy.sourcetags = sourceinv.getAllEntries()
static

Definition at line 98 of file DBCopy.py.

tuple python.DBCopy.DBCopy.t = TagTree.tagTree(self.__sourcesession,treename)
static

Definition at line 90 of file DBCopy.py.

tuple python.DBCopy.DBCopy.tablelist = list(self.__sourcesession.nominalSchema().listTables())
static

Definition at line 195 of file DBCopy.py.

tuple python.DBCopy.DBCopy.tagiddict = inv.bulkInsertEntries(entries)
static

Definition at line 112 of file DBCopy.py.

list python.DBCopy.DBCopy.treename = tablename[posbeg+len('TAGTREE_TABLE_'):]
static

Definition at line 220 of file DBCopy.py.

list python.DBCopy.DBCopy.trees = []
static

Definition at line 192 of file DBCopy.py.