CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
lumidbDDL Namespace Reference

Functions

def createFKConstraints
 
def createIndices
 
def createNULLConstraints
 
def createOldSchema
 
def createTables
 
def createUniqueConstraints
 
def describe
 
def describeIndices
 
def dropFKConstrains
 
def dropIndices
 
def dropNULLConstraints
 
def dropTables
 
def dropUNIQUEConstraints
 
def newToOld
 
def oldToNew
 

Variables

string authpath = '/afs/cern.ch/user/x/xiezhen'
 
string myconstr = 'oracle://devdb10/cms_xiezhen_dev'
 
tuple schema = session.nominalSchema()
 
tuple session = svc.openSession(isReadOnly=False,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])
 
tuple svc = sessionManager.sessionManager(myconstr,authpath=authpath,debugON=False)
 
tuple tables = createTables(schema)
 

Function Documentation

def lumidbDDL.createFKConstraints (   schema)
 

Definition at line 449 of file lumidbDDL.py.

450 def createFKConstraints(schema):
451  '''
452  '''
pass
def createFKConstraints
Definition: lumidbDDL.py:449
def lumidbDDL.createIndices (   schema)
 

Definition at line 434 of file lumidbDDL.py.

435 def createIndices(schema):
436  '''
437  '''
438  pass
439  #cmsrunsummary.createIndex('cmsrunsummary_fillnum',('FILLNUM'))
440  #cmsrunsummary.createIndex('cmsrunsummary_startime',('STARTTIME'))
def createIndices
Definition: lumidbDDL.py:434
def lumidbDDL.createNULLConstraints (   schema)
 

Definition at line 457 of file lumidbDDL.py.

458 def createNULLConstraints(schema):
459  '''
460  '''
461  #cmsrunsummary.setNotNullConstraint('HLTKEY',True)
462  #cmsrunsummary.setNotNullConstraint('FILLNUM',True)
463  #cmsrunsummary.setNotNullConstraint('SEQUENCE',True)
pass
def createNULLConstraints
Definition: lumidbDDL.py:457
def lumidbDDL.createOldSchema (   schema)
create tables of lumidb1 if not exist

Definition at line 236 of file lumidbDDL.py.

References nameDealer.cmsrunsummaryTableName(), nameDealer.hltTableName(), nameDealer.lumidetailTableName(), nameDealer.lumisummaryTableName(), nameDealer.lumivalidationTableName(), nameDealer.trghltMapTableName(), and nameDealer.trgTableName().

237 def createOldSchema(schema):
238  '''
239  create tables of lumidb1 if not exist
240  '''
241  try:
242  created=[]
243  db=dbUtil.dbUtil(schema)
244  if not schema.existsTable(nameDealer.lumivalidationTableName()):
245  lumivalidation=coral.TableDescription()
246  lumivalidation.setName( nameDealer.lumivalidationTableName() )
247  lumivalidation.insertColumn( 'RUNNUM','unsigned int' )
248  lumivalidation.insertColumn( 'CMSLSNUM','unsigned int' )
249  lumivalidation.insertColumn( 'FLAG','string',28,False )
250  lumivalidation.insertColumn( 'COMMENT','string',1024,False )
251  lumivalidation.setPrimaryKey(('RUNNUM','CMSLSNUM'))
252  lumivalidation.setNotNullConstraint('FLAG',True)
253  db.createTable(lumivalidation,withIdTable=False)
254  created.append(nameDealer.lumivalidationTableName())
255 
256  if not schema.existsTable(nameDealer.cmsrunsummaryTableName()):
257  cmsrunsummary=coral.TableDescription()
258  cmsrunsummary.setName( nameDealer.cmsrunsummaryTableName() )
259  cmsrunsummary.insertColumn('RUNNUM','unsigned int')
260  cmsrunsummary.insertColumn('HLTKEY','string',128,False)
261  cmsrunsummary.insertColumn('FILLNUM','unsigned int')
262  cmsrunsummary.insertColumn('SEQUENCE','string',56,False)
263  cmsrunsummary.insertColumn('STARTTIME','time stamp',6)
264  cmsrunsummary.insertColumn('STOPTIME','time stamp',6)
265  cmsrunsummary.setPrimaryKey('RUNNUM')
266  cmsrunsummary.setNotNullConstraint('HLTKEY',True)
267  cmsrunsummary.setNotNullConstraint('FILLNUM',True)
268  cmsrunsummary.setNotNullConstraint('SEQUENCE',True)
269  cmsrunsummary.createIndex('cmsrunsummary_fillnum',('FILLNUM'))
270  cmsrunsummary.createIndex('cmsrunsummary_startime',('STARTTIME'))
271  db.createTable(cmsrunsummary,withIdTable=False)
272  created.append(nameDealer.cmsrunsummaryTableName())
273 
274  if not schema.existsTable(nameDealer.lumisummaryTableName()):
275  summary=coral.TableDescription()
276  summary.setName( nameDealer.lumisummaryTableName() )
277  summary.insertColumn('LUMISUMMARY_ID','unsigned long long')
278  summary.insertColumn('RUNNUM','unsigned int')
279  summary.insertColumn('CMSLSNUM','unsigned int')
280  summary.insertColumn('LUMILSNUM','unsigned int')
281  summary.insertColumn('LUMIVERSION','string',28,False)
282  summary.insertColumn('DTNORM','float')
283  summary.insertColumn('LHCNORM','float')
284  summary.insertColumn('CMSALIVE','short')
285  summary.insertColumn('INSTLUMI','float')
286  summary.insertColumn('INSTLUMIERROR','float')
287  summary.insertColumn('INSTLUMIQUALITY','short')
288  summary.insertColumn('BEAMSTATUS','string',28,False)
289  summary.insertColumn('BEAMENERGY','float')
290  summary.insertColumn('NUMORBIT','unsigned int')
291  summary.insertColumn('STARTORBIT','unsigned int')
292  summary.insertColumn('LUMISECTIONQUALITY','short')
293  summary.insertColumn('CMSBXINDEXBLOB','blob')
294  summary.insertColumn('BEAMINTENSITYBLOB_1','blob')
295  summary.insertColumn('BEAMINTENSITYBLOB_2','blob')
296  summary.setPrimaryKey('LUMISUMMARY_ID')
297  summary.setNotNullConstraint('RUNNUM',True)
298  summary.setNotNullConstraint('CMSLSNUM',True)
299  summary.setNotNullConstraint('LUMILSNUM',True)
300  summary.setNotNullConstraint('CMSALIVE',True)
301  summary.setNotNullConstraint('LUMIVERSION',True)
302  summary.setNotNullConstraint('DTNORM',True)
303  summary.setNotNullConstraint('LHCNORM',True)
304  summary.setNotNullConstraint('INSTLUMI',True)
305  summary.setNotNullConstraint('INSTLUMIERROR',True)
306  summary.setNotNullConstraint('INSTLUMIQUALITY',True)
307  summary.setNotNullConstraint('STARTORBIT',True)
308  summary.setNotNullConstraint('NUMORBIT',True)
309  summary.setNotNullConstraint('LUMISECTIONQUALITY',True)
310  summary.setNotNullConstraint('BEAMENERGY',True)
311  summary.setNotNullConstraint('BEAMSTATUS',True)
312  summary.setUniqueConstraint(('RUNNUM','LUMIVERSION','LUMILSNUM'))
313  summary.createIndex('lumisummary_runnum',('RUNNUM'))
314  db.createTable(summary,withIdTable=True)
315  created.append(nameDealer.lumisummaryTableName())
316 
317  if not schema.existsTable(nameDealer.lumidetailTableName()):
318  detail=coral.TableDescription()
319  detail.setName( nameDealer.lumidetailTableName() )
320  detail.insertColumn('LUMIDETAIL_ID','unsigned long long')
321  detail.insertColumn('LUMISUMMARY_ID','unsigned long long')
322  detail.insertColumn('BXLUMIVALUE','blob')
323  detail.insertColumn('BXLUMIERROR','blob')
324  detail.insertColumn('BXLUMIQUALITY','blob')
325  detail.insertColumn('ALGONAME','string',28,False)
326  detail.setPrimaryKey('LUMIDETAIL_ID')
327  detail.createForeignKey('DETAILSOURCE','LUMISUMMARY_ID',nameDealer.lumisummaryTableName(),'LUMISUMMARY_ID')
328  detail.setNotNullConstraint('BXLUMIVALUE',True)
329  detail.setNotNullConstraint('BXLUMIERROR',True)
330  detail.setNotNullConstraint('BXLUMIQUALITY',True)
331  detail.setNotNullConstraint('ALGONAME',True)
332  detail.setUniqueConstraint(('LUMISUMMARY_ID','ALGONAME'))
333  db.createTable(detail,withIdTable=True)
334  created.append(nameDealer.lumidetailTableName())
335 
336  if not schema.existsTable(nameDealer.trgTableName()):
337  trg=coral.TableDescription()
338  trg.setName( nameDealer.trgTableName() )
339  trg.insertColumn('TRG_ID','unsigned long long')
340  trg.insertColumn('RUNNUM','unsigned int')
341  trg.insertColumn('CMSLSNUM','unsigned int')
342  trg.insertColumn('BITNUM','unsigned int')
343  trg.insertColumn('BITNAME','string',56,False)
344  trg.insertColumn('TRGCOUNT','unsigned int')
345  trg.insertColumn('DEADTIME','unsigned long long')
346  trg.insertColumn('PRESCALE','unsigned int')
347  trg.setNotNullConstraint('RUNNUM',True)
348  trg.setNotNullConstraint('CMSLSNUM',True)
349  trg.setNotNullConstraint('BITNUM',True)
350  trg.setNotNullConstraint('BITNAME',True)
351  trg.setNotNullConstraint('TRGCOUNT',True)
352  trg.setNotNullConstraint('DEADTIME',True)
353  trg.setNotNullConstraint('PRESCALE',True)
354  trg.setPrimaryKey('TRG_ID')
355  trg.createIndex('trg_runnum',('RUNNUM'))
356  db.createTable(trg,withIdTable=True)
357  created.append( nameDealer.trgTableName() )
358 
359  if not schema.existsTable( nameDealer.hltTableName() ):
360  hlt=coral.TableDescription()
361  hlt.setName( nameDealer.hltTableName() )
362  hlt.insertColumn( 'HLT_ID','unsigned long long')
363  hlt.insertColumn( 'RUNNUM','unsigned int')
364  hlt.insertColumn( 'CMSLSNUM','unsigned int')
365  hlt.insertColumn( 'PATHNAME','string',256,False)
366  hlt.insertColumn( 'INPUTCOUNT','unsigned int')
367  hlt.insertColumn( 'ACCEPTCOUNT','unsigned int')
368  hlt.insertColumn( 'PRESCALE','unsigned int')
369  hlt.setPrimaryKey( 'HLT_ID' )
370  hlt.setNotNullConstraint('RUNNUM',True)
371  hlt.setNotNullConstraint('CMSLSNUM',True)
372  hlt.setNotNullConstraint('PATHNAME',True)
373  hlt.setNotNullConstraint('INPUTCOUNT',True)
374  hlt.setNotNullConstraint('ACCEPTCOUNT',True)
375  hlt.setNotNullConstraint('PRESCALE',True)
376  hlt.createIndex('hlt_runnum',('RUNNUM'))
377  db.createTable(hlt,withIdTable=True)
378  created.append( nameDealer.hltTableName() )
379 
380  if not schema.existsTable( nameDealer.trghltMapTableName() ):
381  trghlt=coral.TableDescription()
382  trghlt.setName( nameDealer.trghltMapTableName() )
383  trghlt.insertColumn( 'HLTKEY','string',128,False )
384  trghlt.insertColumn( 'HLTPATHNAME','string',256,False )
385  trghlt.insertColumn( 'L1SEED','string',1024,false )
386  trghlt.setNotNullConstraint('HLTKEY',True)
387  trghlt.setNotNullConstraint('HLTPATHNAME',True)
388  trghlt.setNotNullConstraint('L1SEED',True)
389  db.createTable(trghlt,withIdTable=False)
390  created.append( nameDealer.trghltMapTableName() )
391  return created
392  except:
393  raise
394 
395 #=======================================================
396 #
397 # MODIFY
398 #
#=======================================================
def createOldSchema
Definition: lumidbDDL.py:236
def lumivalidationTableName
Definition: nameDealer.py:85
def lumisummaryTableName
Definition: nameDealer.py:25
def trghltMapTableName
Definition: nameDealer.py:76
def hltTableName
Definition: nameDealer.py:55
def lumidetailTableName
Definition: nameDealer.py:34
def trgTableName
Definition: nameDealer.py:52
def cmsrunsummaryTableName
Definition: nameDealer.py:16
def lumidbDDL.createTables (   schema)
create new tables if not exist
revisions,revisions_id,luminorms,luminorms_entries,luminorms_entries_id,fillscheme

Definition at line 8 of file lumidbDDL.py.

References nameDealer.cmsrunsummaryTableName(), nameDealer.fillschemeTableName(), nameDealer.hltdataTableName(), nameDealer.hltTableName(), nameDealer.lshltTableName(), nameDealer.lstrgTableName(), nameDealer.lumidataTableName(), nameDealer.luminormTableName(), nameDealer.lumisummaryv2TableName(), nameDealer.lumivalidationTableName(), nameDealer.revisionTableName(), nameDealer.trgdataTableName(), and nameDealer.trghltMapTableName().

Referenced by lumidb2Schema.createLumi(), and oldToNew().

8 
9 def createTables(schema):
10  '''
11  create new tables if not exist
12  revisions,revisions_id,luminorms,luminorms_entries,luminorms_entries_id,fillscheme
13  '''
14  try:
15  created=[]
16  db=dbUtil.dbUtil(schema)
17  if not schema.existsTable(nameDealer.fillschemeTableName()):
18  print 'creating fillscheme table'
19  fillschemeTab=coral.TableDescription()
20  fillschemeTab.setName( nameDealer.fillschemeTableName() )
21  fillschemeTab.insertColumn( 'FILLSCHEME_ID','unsigned long long' )
22  fillschemeTab.insertColumn( 'FILLSCHEMEPATTERN','string',128,False )
23  fillschemeTab.insertColumn( 'CORRECTIONFACTOR','float' )
24  fillschemeTab.setPrimaryKey( 'FILLSCHEME_ID' )
25  db.createTable(fillschemeTab,withIdTable=True)
26  created.append( nameDealer.fillschemeTableName() )
27 
28  if not schema.existsTable(nameDealer.revisionTableName()):
29  print 'creating revisions table'
30  revisionsTab=coral.TableDescription()
31  revisionsTab.setName( nameDealer.revisionTableName() )
32  revisionsTab.insertColumn( 'REVISION_ID','unsigned long long')
33  revisionsTab.insertColumn( 'BRANCH_ID','unsigned long long')
34  revisionsTab.insertColumn( 'NAME', 'string',56,False)
35  revisionsTab.insertColumn( 'BRANCH_NAME', 'string',56,False)
36  revisionsTab.insertColumn( 'COMMENT', 'string',1024,False)
37  revisionsTab.insertColumn( 'CTIME', 'time stamp',6)
38  revisionsTab.setPrimaryKey( 'REVISION_ID' )
39  revisionsTab.setUniqueConstraint(('NAME'))
40  db.createTable(revisionsTab,withIdTable=True)
41  created.append(nameDealer.revisionTableName())
42 
43  if not schema.existsTable(nameDealer.luminormTableName()):
44  print 'creating luminorms table'
45  luminormsTab=coral.TableDescription()
46  luminormsTab.setName( nameDealer.luminormTableName() )
47  luminormsTab.insertColumn( 'DATA_ID','unsigned long long')
48  luminormsTab.insertColumn( 'ENTRY_ID','unsigned long long')
49  luminormsTab.insertColumn( 'ENTRY_NAME','string',56,False)
50  luminormsTab.insertColumn( 'AMODETAG', 'string',28,False)
51  luminormsTab.insertColumn( 'NORM_1', 'float')
52  luminormsTab.insertColumn( 'EGEV_1', 'unsigned int')
53  luminormsTab.insertColumn( 'NORM_2', 'float')
54  luminormsTab.insertColumn( 'EGEV_2', 'unsigned int')
55  luminormsTab.setPrimaryKey( 'DATA_ID' )
56  db.createTable(luminormsTab,withIdTable=True,withEntryTables=True,withRevMapTable=True)
57  created.append(nameDealer.luminormTableName())
58 
59  if not schema.existsTable(nameDealer.lumidataTableName()):
60  print 'creating lumidata table'
61  lumidataTab=coral.TableDescription()
62  lumidataTab.setName( nameDealer.lumidataTableName() )
63  lumidataTab.insertColumn( 'DATA_ID','unsigned long long')
64  lumidataTab.insertColumn( 'ENTRY_ID','unsigned long long')
65  lumidataTab.insertColumn( 'ENTRY_NAME','string',56,False)
66  lumidataTab.insertColumn( 'SOURCE', 'string',128,False)
67  lumidataTab.insertColumn( 'RUNNUM', 'unsigned int')
68  lumidataTab.insertColumn( 'NOMINALEGEV', 'float')
69  lumidataTab.setPrimaryKey( 'DATA_ID' )
70  db.createTable(lumidataTab,withIdTable=True,withEntryTables=True,withRevMapTable=True)
71  created.append(nameDealer.lumidataTableName())
72 
73  if not schema.existsTable(nameDealer.lumisummaryv2TableName() ):
74  print 'creating lumisummaryv2 table'
75  summary=coral.TableDescription()
76  summary.setName( nameDealer.lumisummaryv2TableName() )
77  summary.insertColumn('DATA_ID','unsigned long long')
78  summary.insertColumn('RUNNUM','unsigned int')
79  summary.insertColumn('LUMILSNUM','unsigned int')
80  summary.insertColumn('CMSLSNUM','unsigned int')
81  summary.insertColumn('INSTLUMI','float')
82  summary.insertColumn('INSTLUMIERROR','float')
83  summary.insertColumn('INSTLUMIQUALITY','short')
84  summary.insertColumn('BEAMSTATUS','string',28,False)
85  summary.insertColumn('BEAMENERGY','float')
86  summary.insertColumn('NUMORBIT','unsigned int')
87  summary.insertColumn('STARTORBIT','unsigned int')
88  summary.insertColumn('CMSBXINDEXBLOB','blob')
89  summary.insertColumn('BEAMINTENSITYBLOB_1','blob')
90  summary.insertColumn('BEAMINTENSITYBLOB_2','blob')
91  summary.insertColumn('BXLUMIVALUE_OCC1','blob')
92  summary.insertColumn('BXLUMIVALUE_OCC2','blob')
93  summary.insertColumn('BXLUMIVALUE_ET','blob')
94  summary.insertColumn('BXLUMIERROR_OCC1','blob')
95  summary.insertColumn('BXLUMIERROR_OCC2','blob')
96  summary.insertColumn('BXLUMIERROR_ET','blob')
97  summary.insertColumn('BXLUMIQUALITY_OCC1','blob')
98  summary.insertColumn('BXLUMIQUALITY_OCC2','blob')
99  summary.insertColumn('BXLUMIQUALITY_ET','blob')
100  summary.setPrimaryKey(('DATA_ID','LUMILSNUM'))
101  db.createTable(summary,withIdTable=False)
102  created.append(nameDealer.lumisummaryv2TableName())
103 
104  #
105  # This table exists in the old schema
106  #
107  if not schema.existsTable(nameDealer.cmsrunsummaryTableName()):
108  print 'creating cmsrunsummary table'
109  cmsrunsummary=coral.TableDescription()
110  cmsrunsummary.setName( nameDealer.cmsrunsummaryTableName() )
111  cmsrunsummary.insertColumn('RUNNUM','unsigned int')
112  cmsrunsummary.insertColumn('HLTKEY','string',128,False)
113  cmsrunsummary.insertColumn('L1KEY','string',128,False)
114  cmsrunsummary.insertColumn('FILLNUM','unsigned int')
115  cmsrunsummary.insertColumn('SEQUENCE','string',56,False)
116  cmsrunsummary.insertColumn('STARTTIME','time stamp',6)
117  cmsrunsummary.insertColumn('STOPTIME','time stamp',6)
118  cmsrunsummary.insertColumn('EGEV','unsigned int')
119  cmsrunsummary.insertColumn('AMODETAG','string',28,False)
120  cmsrunsummary.insertColumn('FILLSCHEME','string',128,False)
121  cmsrunsummary.insertColumn('NCOLLIDINGBUNCHES','usigned int')
122  cmsrunsummary.setPrimaryKey('RUNNUM')
123  db.createTable(cmsrunsummary,withIdTable=False)
124  created.append(nameDealer.cmsrunsummaryTableName())
125  #
126  # This table exists in the old schema
127  #
128  if not schema.existsTable(nameDealer.trghltMapTableName()):
129  print 'creating trghltmap table'
130  trghlt=coral.TableDescription()
131  trghlt.setName( nameDealer.trghltMapTableName() )
132  trghlt.insertColumn( 'HLTKEY','string',128,False )
133  trghlt.insertColumn( 'HLTPATHNAME','string',256,False )
134  trghlt.insertColumn( 'L1SEED','string' ,1024,False)
135  trghlt.setNotNullConstraint('HLTKEY',True)
136  trghlt.setNotNullConstraint('HLTPATHNAME',True)
137  trghlt.setNotNullConstraint('L1SEED',True)
138  db.createTable(trghlt,withIdTable=False)
139  created.append(nameDealer.trghltMapTableName())
140  if not schema.existsTable(nameDealer.trgdataTableName()):
141  print 'creating trgdata table'
142  trgdataTab=coral.TableDescription()
143  trgdataTab.setName( nameDealer.trgdataTableName() )
144  trgdataTab.insertColumn( 'DATA_ID','unsigned long long')
145  trgdataTab.insertColumn( 'ENTRY_ID','unsigned long long')
146  trgdataTab.insertColumn( 'ENTRY_NAME','string',56,False)
147  trgdataTab.insertColumn( 'SOURCE', 'string',128,False)
148  trgdataTab.insertColumn( 'RUNNUM', 'unsigned int')
149  trgdataTab.insertColumn( 'BITZERONAME', 'string',56,False)
150  trgdataTab.insertColumn( 'BITNAMECLOB', 'string',6000)
151  trgdataTab.setPrimaryKey( 'DATA_ID' )
152  db.createTable(trgdataTab,withIdTable=True,withEntryTables=True,withRevMapTable=True)
153  created.append(nameDealer.trgdataTableName())
154  if not schema.existsTable(nameDealer.lstrgTableName()):
155  print 'creating lstrg table'
156  lstrgTab=coral.TableDescription()
157  lstrgTab.setName( nameDealer.lstrgTableName() )
158  lstrgTab.insertColumn( 'DATA_ID','unsigned long long')
159  lstrgTab.insertColumn( 'RUNNUM', 'unsigned int')
160  lstrgTab.insertColumn( 'CMSLSNUM', 'unsigned int')
161  lstrgTab.insertColumn( 'DEADTIMECOUNT', 'unsigned long long')
162  lstrgTab.insertColumn( 'BITZEROCOUNT', 'unsigned int')
163  lstrgTab.insertColumn( 'BITZEROPRESCALE', 'unsigned int')
164  lstrgTab.insertColumn( 'DEADFRAC', 'float')
165  lstrgTab.insertColumn( 'PRESCALEBLOB', 'blob')
166  lstrgTab.insertColumn( 'TRGCOUNTBLOB', 'blob')
167  lstrgTab.setPrimaryKey( ('DATA_ID','CMSLSNUM') )
168  db.createTable(lstrgTab,withIdTable=False)
169  created.append( nameDealer.lstrgTableName() )
170 
171  if not schema.existsTable(nameDealer.hltdataTableName()):
172  print 'creating hltdata table'
173  hltdataTab=coral.TableDescription()
174  hltdataTab.setName( nameDealer.hltdataTableName() )
175  hltdataTab.insertColumn( 'DATA_ID','unsigned long long')
176  hltdataTab.insertColumn( 'ENTRY_ID','unsigned long long')
177  hltdataTab.insertColumn( 'ENTRY_NAME','string',56,False)
178  hltdataTab.insertColumn( 'RUNNUM', 'unsigned int')
179  hltdataTab.insertColumn( 'SOURCE', 'string',128,False)
180  hltdataTab.insertColumn( 'NPATH', 'unsigned int')
181  hltdataTab.insertColumn( 'PATHNAMECLOB', 'string',6000)
182  hltdataTab.setPrimaryKey( 'DATA_ID' )
183  db.createTable(hltdataTab,withIdTable=True,withEntryTables=True,withRevMapTable=True)
184  created.append(nameDealer.hltTableName())
185 
186  if not schema.existsTable(nameDealer.lshltTableName()):
187  print 'creating lshlt table'
188  lshltTab=coral.TableDescription()
189  lshltTab.setName( nameDealer.lshltTableName() )
190  lshltTab.insertColumn( 'DATA_ID','unsigned long long')
191  lshltTab.insertColumn( 'RUNNUM', 'unsigned int')
192  lshltTab.insertColumn( 'CMSLSNUM', 'unsigned int')
193  lshltTab.insertColumn( 'PRESCALEBLOB', 'blob')
194  lshltTab.insertColumn( 'HLTCOUNTBLOB', 'blob')
195  lshltTab.insertColumn( 'HLTACCEPTBLOB', 'blob')
196  db.createTable(lshltTab,withIdTable=False)
197  lshltTab.setPrimaryKey( ('DATA_ID','CMSLSNUM') )
198  created.append(nameDealer.lshltTableName())
199 
200 
201  if not schema.existsTable(nameDealer.lumivalidationTableName()):
202  print 'creating lumivalidation table'
203  lumivalidation=coral.TableDescription()
204  lumivalidation.setName( nameDealer.lumivalidationTableName() )
205  lumivalidation.insertColumn( 'RUNNUM','unsigned int' )
206  lumivalidation.insertColumn( 'CMSLSNUM','unsigned int' )
207  lumivalidation.insertColumn( 'FLAG','string',28,False )
208  lumivalidation.insertColumn( 'COMMENT','string',1024,False )
209  lumivalidation.setPrimaryKey( ('RUNNUM','CMSLSNUM') )
210  lumivalidation.setNotNullConstraint('FLAG',True)
211  db.createTable(lumivalidation,withIdTable=False)
212  created.append(nameDealer.lumivalidationTableName())
213  return created
214  except :
215  raise
216 
217 
218 #=======================================================
219 #
220 # DROP
221 #
#=======================================================
def lstrgTableName
Definition: nameDealer.py:49
def lumivalidationTableName
Definition: nameDealer.py:85
def trghltMapTableName
Definition: nameDealer.py:76
def revisionTableName
Definition: nameDealer.py:11
def hltTableName
Definition: nameDealer.py:55
def trgdataTableName
Definition: nameDealer.py:46
def hltdataTableName
Definition: nameDealer.py:58
def createTables
Definition: lumidbDDL.py:8
def lshltTableName
Definition: nameDealer.py:61
def lumidataTableName
Definition: nameDealer.py:19
def luminormTableName
Definition: nameDealer.py:37
def fillschemeTableName
Definition: nameDealer.py:13
def lumisummaryv2TableName
Definition: nameDealer.py:28
def cmsrunsummaryTableName
Definition: nameDealer.py:16
def lumidbDDL.createUniqueConstraints (   schema)
 

Definition at line 469 of file lumidbDDL.py.

470 def createUniqueConstraints(schema):
471  '''
472  '''
473  try:
474  revtable=schema.tableHandle(nameDealer.revisionTableName())
475  revtable.schemaEditor().setUniqueConstraint('NAME','revisions_name_uc')
476  except:
raise
def revisionTableName
Definition: nameDealer.py:11
def createUniqueConstraints
Definition: lumidbDDL.py:469
def lumidbDDL.describe (   schema)
 

Definition at line 482 of file lumidbDDL.py.

483 def describe(schema):
484  '''
485  '''
486  pass
def describe
Definition: lumidbDDL.py:482
def lumidbDDL.describeIndices (   schema)
 

Definition at line 445 of file lumidbDDL.py.

446 def describeIndices(schema):
447  '''
448  '''
pass
def describeIndices
Definition: lumidbDDL.py:445
def lumidbDDL.dropFKConstrains (   schema)
 

Definition at line 453 of file lumidbDDL.py.

454 def dropFKConstrains(schema):
455  '''
456  '''
pass
def dropFKConstrains
Definition: lumidbDDL.py:453
def lumidbDDL.dropIndices (   schema)
 

Definition at line 441 of file lumidbDDL.py.

442 def dropIndices(schema):
443  '''
444  '''
pass
def dropIndices
Definition: lumidbDDL.py:441
def lumidbDDL.dropNULLConstraints (   schema)
 

Definition at line 464 of file lumidbDDL.py.

465 def dropNULLConstraints(schema):
466  '''
467  '''
468  pass
def dropNULLConstraints
Definition: lumidbDDL.py:464
def lumidbDDL.dropTables (   schema,
  tablelist 
)

Definition at line 222 of file lumidbDDL.py.

References nameDealer.entryTableName(), nameDealer.hltdataTableName(), nameDealer.hltTableName(), nameDealer.idTableName(), nameDealer.lumidataTableName(), nameDealer.lumidetailTableName(), nameDealer.luminormTableName(), nameDealer.lumisummaryTableName(), nameDealer.lumisummaryv2TableName(), nameDealer.revmapTableName(), nameDealer.trgdataTableName(), and nameDealer.trgTableName().

Referenced by lumidb2Schema.dropLumi(), and newToOld().

223 def dropTables(schema,tablelist):
224  try:
225  db=dbUtil.dbUtil(schema)
226  for tablename in tablelist:
228  db.dropTable( nameDealer.idTableName(tablename) )
229  db.dropTable( nameDealer.entryTableName(tablename) )
230  db.dropTable( nameDealer.revmapTableName(tablename) )
232  db.dropTable( nameDealer.idTableName(tablename) )
233  db.dropTable( tablename )
234  except :
235  raise
def revmapTableName
Definition: nameDealer.py:100
def lumisummaryTableName
Definition: nameDealer.py:25
def idTableName
Definition: nameDealer.py:94
def hltTableName
Definition: nameDealer.py:55
def trgdataTableName
Definition: nameDealer.py:46
def lumidetailTableName
Definition: nameDealer.py:34
def hltdataTableName
Definition: nameDealer.py:58
def entryTableName
Definition: nameDealer.py:103
def lumidataTableName
Definition: nameDealer.py:19
def dropTables
Definition: lumidbDDL.py:222
def luminormTableName
Definition: nameDealer.py:37
def lumisummaryv2TableName
Definition: nameDealer.py:28
def trgTableName
Definition: nameDealer.py:52
def lumidbDDL.dropUNIQUEConstraints (   schema)
 

Definition at line 477 of file lumidbDDL.py.

478 def dropUNIQUEConstraints(schema):
479  '''
480  '''
481  pass
def dropUNIQUEConstraints
Definition: lumidbDDL.py:477
def lumidbDDL.newToOld (   schema)

Definition at line 413 of file lumidbDDL.py.

References nameDealer.cmsrunsummaryTableName(), dropTables(), and mergeVDriftHistosByStation.name.

414 def newToOld(schema):
415  try:
416  dropTables(schema,['REVISIONS','LUMINORMS','LUMIDATA','LUMISUMMARYV2','TRGDATA','LSTRG','HLTDATA','LSHLT'])
417  tableHandle=schema.tableHandle(nameDealer.cmsrunsummaryTableName())
418  ncol=tableHandle.description().numberOfColumns()
419  todrop=[]
420  for i in range(ncol):
421  colname=tableHandle.description().columnDescription(i).name()
422  if colname in ['L1KEY','EGEV','AMODETAG']:
423  todrop.append(colname)
424  for colname in todrop:
425  tableHandle.schemaEditor().dropColumn(colname)
426  except :
427  raise
428 
429 #=======================================================
430 #
431 # TODO
432 #
433 #=======================================================
def newToOld
Definition: lumidbDDL.py:413
def dropTables
Definition: lumidbDDL.py:222
def cmsrunsummaryTableName
Definition: nameDealer.py:16
def lumidbDDL.oldToNew (   schema)
modify old tables:cmsrunsummary
alter table cmsrunsummary add column(l1key string,egev unsigned int,amodetag string)

Definition at line 399 of file lumidbDDL.py.

References nameDealer.cmsrunsummaryTableName(), and createTables().

400 def oldToNew(schema):
401  '''
402  modify old tables:cmsrunsummary
403  alter table cmsrunsummary add column(l1key string,egev unsigned int,amodetag string)
404  '''
405  try:
406  tableHandle=schema.tableHandle(nameDealer.cmsrunsummaryTableName())
407  tableHandle.schemaEditor().insertColumn('L1KEY','string',128,False)
408  tableHandle.schemaEditor().insertColumn('EGEV','unsigned int')
409  tableHandle.schemaEditor().insertColumn('AMODETAG','string',28,False)
410  createTables(schema)
411  except:
412  raise
def oldToNew
Definition: lumidbDDL.py:399
def createTables
Definition: lumidbDDL.py:8
def cmsrunsummaryTableName
Definition: nameDealer.py:16

Variable Documentation

string lumidbDDL.authpath = '/afs/cern.ch/user/x/xiezhen'

Definition at line 490 of file lumidbDDL.py.

string lumidbDDL.myconstr = 'oracle://devdb10/cms_xiezhen_dev'

Definition at line 489 of file lumidbDDL.py.

tuple lumidbDDL.schema = session.nominalSchema()

Definition at line 494 of file lumidbDDL.py.

tuple lumidbDDL.session = svc.openSession(isReadOnly=False,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])

Definition at line 493 of file lumidbDDL.py.

tuple lumidbDDL.svc = sessionManager.sessionManager(myconstr,authpath=authpath,debugON=False)

Definition at line 492 of file lumidbDDL.py.

tuple lumidbDDL.tables = createTables(schema)

Definition at line 496 of file lumidbDDL.py.