CMS 3D CMS Logo

Functions | Variables
lumidbDDL Namespace Reference

Functions

def createFKConstraints (schema)
 
def createIndices (schema)
 
def createNULLConstraints (schema)
 
def createOldSchema (schema)
 
def createTables (schema)
 
def createUniqueConstraints (schema)
 
def describe (schema)
 
def describeIndices (schema)
 
def dropFKConstrains (schema)
 
def dropIndices (schema)
 
def dropNULLConstraints (schema)
 
def dropTables (schema, tablelist)
 
def dropUNIQUEConstraints (schema)
 
def newToOld (schema)
 
def oldToNew (schema)
 

Variables

 authpath
 
 cpp2sqltype
 
 debugON
 
 False
 
 isReadOnly
 
 myconstr
 
 schema
 
 session
 
 svc
 
 tables
 

Function Documentation

def lumidbDDL.createFKConstraints (   schema)
 

Definition at line 449 of file lumidbDDL.py.

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

Definition at line 434 of file lumidbDDL.py.

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

Definition at line 457 of file lumidbDDL.py.

458  '''
459  '''
460  #cmsrunsummary.setNotNullConstraint('HLTKEY',True)
461  #cmsrunsummary.setNotNullConstraint('FILLNUM',True)
462  #cmsrunsummary.setNotNullConstraint('SEQUENCE',True)
463  pass
def createNULLConstraints(schema)
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().

236 def createOldSchema(schema):
237  '''
238  create tables of lumidb1 if not exist
239  '''
240  try:
241  created=[]
242  db=dbUtil.dbUtil(schema)
243  if not schema.existsTable(nameDealer.lumivalidationTableName()):
244  lumivalidation=coral.TableDescription()
245  lumivalidation.setName( nameDealer.lumivalidationTableName() )
246  lumivalidation.insertColumn( 'RUNNUM','unsigned int' )
247  lumivalidation.insertColumn( 'CMSLSNUM','unsigned int' )
248  lumivalidation.insertColumn( 'FLAG','string',28,False )
249  lumivalidation.insertColumn( 'COMMENT','string',1024,False )
250  lumivalidation.setPrimaryKey(('RUNNUM','CMSLSNUM'))
251  lumivalidation.setNotNullConstraint('FLAG',True)
252  db.createTable(lumivalidation,withIdTable=False)
253  created.append(nameDealer.lumivalidationTableName())
254 
255  if not schema.existsTable(nameDealer.cmsrunsummaryTableName()):
256  cmsrunsummary=coral.TableDescription()
257  cmsrunsummary.setName( nameDealer.cmsrunsummaryTableName() )
258  cmsrunsummary.insertColumn('RUNNUM','unsigned int')
259  cmsrunsummary.insertColumn('HLTKEY','string',128,False)
260  cmsrunsummary.insertColumn('FILLNUM','unsigned int')
261  cmsrunsummary.insertColumn('SEQUENCE','string',56,False)
262  cmsrunsummary.insertColumn('STARTTIME','time stamp',6)
263  cmsrunsummary.insertColumn('STOPTIME','time stamp',6)
264  cmsrunsummary.setPrimaryKey('RUNNUM')
265  cmsrunsummary.setNotNullConstraint('HLTKEY',True)
266  cmsrunsummary.setNotNullConstraint('FILLNUM',True)
267  cmsrunsummary.setNotNullConstraint('SEQUENCE',True)
268  cmsrunsummary.createIndex('cmsrunsummary_fillnum',('FILLNUM'))
269  cmsrunsummary.createIndex('cmsrunsummary_startime',('STARTTIME'))
270  db.createTable(cmsrunsummary,withIdTable=False)
271  created.append(nameDealer.cmsrunsummaryTableName())
272 
273  if not schema.existsTable(nameDealer.lumisummaryTableName()):
274  summary=coral.TableDescription()
275  summary.setName( nameDealer.lumisummaryTableName() )
276  summary.insertColumn('LUMISUMMARY_ID','unsigned long long')
277  summary.insertColumn('RUNNUM','unsigned int')
278  summary.insertColumn('CMSLSNUM','unsigned int')
279  summary.insertColumn('LUMILSNUM','unsigned int')
280  summary.insertColumn('LUMIVERSION','string',28,False)
281  summary.insertColumn('DTNORM','float')
282  summary.insertColumn('LHCNORM','float')
283  summary.insertColumn('CMSALIVE','short')
284  summary.insertColumn('INSTLUMI','float')
285  summary.insertColumn('INSTLUMIERROR','float')
286  summary.insertColumn('INSTLUMIQUALITY','short')
287  summary.insertColumn('BEAMSTATUS','string',28,False)
288  summary.insertColumn('BEAMENERGY','float')
289  summary.insertColumn('NUMORBIT','unsigned int')
290  summary.insertColumn('STARTORBIT','unsigned int')
291  summary.insertColumn('LUMISECTIONQUALITY','short')
292  summary.insertColumn('CMSBXINDEXBLOB','blob')
293  summary.insertColumn('BEAMINTENSITYBLOB_1','blob')
294  summary.insertColumn('BEAMINTENSITYBLOB_2','blob')
295  summary.setPrimaryKey('LUMISUMMARY_ID')
296  summary.setNotNullConstraint('RUNNUM',True)
297  summary.setNotNullConstraint('CMSLSNUM',True)
298  summary.setNotNullConstraint('LUMILSNUM',True)
299  summary.setNotNullConstraint('CMSALIVE',True)
300  summary.setNotNullConstraint('LUMIVERSION',True)
301  summary.setNotNullConstraint('DTNORM',True)
302  summary.setNotNullConstraint('LHCNORM',True)
303  summary.setNotNullConstraint('INSTLUMI',True)
304  summary.setNotNullConstraint('INSTLUMIERROR',True)
305  summary.setNotNullConstraint('INSTLUMIQUALITY',True)
306  summary.setNotNullConstraint('STARTORBIT',True)
307  summary.setNotNullConstraint('NUMORBIT',True)
308  summary.setNotNullConstraint('LUMISECTIONQUALITY',True)
309  summary.setNotNullConstraint('BEAMENERGY',True)
310  summary.setNotNullConstraint('BEAMSTATUS',True)
311  summary.setUniqueConstraint(('RUNNUM','LUMIVERSION','LUMILSNUM'))
312  summary.createIndex('lumisummary_runnum',('RUNNUM'))
313  db.createTable(summary,withIdTable=True)
314  created.append(nameDealer.lumisummaryTableName())
315 
316  if not schema.existsTable(nameDealer.lumidetailTableName()):
317  detail=coral.TableDescription()
318  detail.setName( nameDealer.lumidetailTableName() )
319  detail.insertColumn('LUMIDETAIL_ID','unsigned long long')
320  detail.insertColumn('LUMISUMMARY_ID','unsigned long long')
321  detail.insertColumn('BXLUMIVALUE','blob')
322  detail.insertColumn('BXLUMIERROR','blob')
323  detail.insertColumn('BXLUMIQUALITY','blob')
324  detail.insertColumn('ALGONAME','string',28,False)
325  detail.setPrimaryKey('LUMIDETAIL_ID')
326  detail.createForeignKey('DETAILSOURCE','LUMISUMMARY_ID',nameDealer.lumisummaryTableName(),'LUMISUMMARY_ID')
327  detail.setNotNullConstraint('BXLUMIVALUE',True)
328  detail.setNotNullConstraint('BXLUMIERROR',True)
329  detail.setNotNullConstraint('BXLUMIQUALITY',True)
330  detail.setNotNullConstraint('ALGONAME',True)
331  detail.setUniqueConstraint(('LUMISUMMARY_ID','ALGONAME'))
332  db.createTable(detail,withIdTable=True)
333  created.append(nameDealer.lumidetailTableName())
334 
335  if not schema.existsTable(nameDealer.trgTableName()):
336  trg=coral.TableDescription()
337  trg.setName( nameDealer.trgTableName() )
338  trg.insertColumn('TRG_ID','unsigned long long')
339  trg.insertColumn('RUNNUM','unsigned int')
340  trg.insertColumn('CMSLSNUM','unsigned int')
341  trg.insertColumn('BITNUM','unsigned int')
342  trg.insertColumn('BITNAME','string',56,False)
343  trg.insertColumn('TRGCOUNT','unsigned int')
344  trg.insertColumn('DEADTIME','unsigned long long')
345  trg.insertColumn('PRESCALE','unsigned int')
346  trg.setNotNullConstraint('RUNNUM',True)
347  trg.setNotNullConstraint('CMSLSNUM',True)
348  trg.setNotNullConstraint('BITNUM',True)
349  trg.setNotNullConstraint('BITNAME',True)
350  trg.setNotNullConstraint('TRGCOUNT',True)
351  trg.setNotNullConstraint('DEADTIME',True)
352  trg.setNotNullConstraint('PRESCALE',True)
353  trg.setPrimaryKey('TRG_ID')
354  trg.createIndex('trg_runnum',('RUNNUM'))
355  db.createTable(trg,withIdTable=True)
356  created.append( nameDealer.trgTableName() )
357 
358  if not schema.existsTable( nameDealer.hltTableName() ):
359  hlt=coral.TableDescription()
360  hlt.setName( nameDealer.hltTableName() )
361  hlt.insertColumn( 'HLT_ID','unsigned long long')
362  hlt.insertColumn( 'RUNNUM','unsigned int')
363  hlt.insertColumn( 'CMSLSNUM','unsigned int')
364  hlt.insertColumn( 'PATHNAME','string',256,False)
365  hlt.insertColumn( 'INPUTCOUNT','unsigned int')
366  hlt.insertColumn( 'ACCEPTCOUNT','unsigned int')
367  hlt.insertColumn( 'PRESCALE','unsigned int')
368  hlt.setPrimaryKey( 'HLT_ID' )
369  hlt.setNotNullConstraint('RUNNUM',True)
370  hlt.setNotNullConstraint('CMSLSNUM',True)
371  hlt.setNotNullConstraint('PATHNAME',True)
372  hlt.setNotNullConstraint('INPUTCOUNT',True)
373  hlt.setNotNullConstraint('ACCEPTCOUNT',True)
374  hlt.setNotNullConstraint('PRESCALE',True)
375  hlt.createIndex('hlt_runnum',('RUNNUM'))
376  db.createTable(hlt,withIdTable=True)
377  created.append( nameDealer.hltTableName() )
378 
379  if not schema.existsTable( nameDealer.trghltMapTableName() ):
380  trghlt=coral.TableDescription()
381  trghlt.setName( nameDealer.trghltMapTableName() )
382  trghlt.insertColumn( 'HLTKEY','string',128,False )
383  trghlt.insertColumn( 'HLTPATHNAME','string',256,False )
384  trghlt.insertColumn( 'L1SEED','string',1024,false )
385  trghlt.setNotNullConstraint('HLTKEY',True)
386  trghlt.setNotNullConstraint('HLTPATHNAME',True)
387  trghlt.setNotNullConstraint('L1SEED',True)
388  db.createTable(trghlt,withIdTable=False)
389  created.append( nameDealer.trghltMapTableName() )
390  return created
391  except:
392  raise
393 
394 #=======================================================
395 #
396 # MODIFY
397 #
398 #=======================================================
def createOldSchema(schema)
Definition: lumidbDDL.py:236
def lumidetailTableName()
Definition: nameDealer.py:34
def trgTableName()
Definition: nameDealer.py:52
def lumisummaryTableName()
Definition: nameDealer.py:25
def lumivalidationTableName()
Definition: nameDealer.py:85
def hltTableName()
Definition: nameDealer.py:55
def cmsrunsummaryTableName()
Definition: nameDealer.py:16
def trghltMapTableName()
Definition: nameDealer.py:76
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 def createTables(schema):
9  '''
10  create new tables if not exist
11  revisions,revisions_id,luminorms,luminorms_entries,luminorms_entries_id,fillscheme
12  '''
13  try:
14  created=[]
15  db=dbUtil.dbUtil(schema)
16  if not schema.existsTable(nameDealer.fillschemeTableName()):
17  print 'creating fillscheme table'
18  fillschemeTab=coral.TableDescription()
19  fillschemeTab.setName( nameDealer.fillschemeTableName() )
20  fillschemeTab.insertColumn( 'FILLSCHEME_ID','unsigned long long' )
21  fillschemeTab.insertColumn( 'FILLSCHEMEPATTERN','string',128,False )
22  fillschemeTab.insertColumn( 'CORRECTIONFACTOR','float' )
23  fillschemeTab.setPrimaryKey( 'FILLSCHEME_ID' )
24  db.createTable(fillschemeTab,withIdTable=True)
25  created.append( nameDealer.fillschemeTableName() )
26 
27  if not schema.existsTable(nameDealer.revisionTableName()):
28  print 'creating revisions table'
29  revisionsTab=coral.TableDescription()
30  revisionsTab.setName( nameDealer.revisionTableName() )
31  revisionsTab.insertColumn( 'REVISION_ID','unsigned long long')
32  revisionsTab.insertColumn( 'BRANCH_ID','unsigned long long')
33  revisionsTab.insertColumn( 'NAME', 'string',56,False)
34  revisionsTab.insertColumn( 'BRANCH_NAME', 'string',56,False)
35  revisionsTab.insertColumn( 'COMMENT', 'string',1024,False)
36  revisionsTab.insertColumn( 'CTIME', 'time stamp',6)
37  revisionsTab.setPrimaryKey( 'REVISION_ID' )
38  revisionsTab.setUniqueConstraint(('NAME'))
39  db.createTable(revisionsTab,withIdTable=True)
40  created.append(nameDealer.revisionTableName())
41 
42  if not schema.existsTable(nameDealer.luminormTableName()):
43  print 'creating luminorms table'
44  luminormsTab=coral.TableDescription()
45  luminormsTab.setName( nameDealer.luminormTableName() )
46  luminormsTab.insertColumn( 'DATA_ID','unsigned long long')
47  luminormsTab.insertColumn( 'ENTRY_ID','unsigned long long')
48  luminormsTab.insertColumn( 'ENTRY_NAME','string',56,False)
49  luminormsTab.insertColumn( 'AMODETAG', 'string',28,False)
50  luminormsTab.insertColumn( 'NORM_1', 'float')
51  luminormsTab.insertColumn( 'EGEV_1', 'unsigned int')
52  luminormsTab.insertColumn( 'NORM_2', 'float')
53  luminormsTab.insertColumn( 'EGEV_2', 'unsigned int')
54  luminormsTab.setPrimaryKey( 'DATA_ID' )
55  db.createTable(luminormsTab,withIdTable=True,withEntryTables=True,withRevMapTable=True)
56  created.append(nameDealer.luminormTableName())
57 
58  if not schema.existsTable(nameDealer.lumidataTableName()):
59  print 'creating lumidata table'
60  lumidataTab=coral.TableDescription()
61  lumidataTab.setName( nameDealer.lumidataTableName() )
62  lumidataTab.insertColumn( 'DATA_ID','unsigned long long')
63  lumidataTab.insertColumn( 'ENTRY_ID','unsigned long long')
64  lumidataTab.insertColumn( 'ENTRY_NAME','string',56,False)
65  lumidataTab.insertColumn( 'SOURCE', 'string',128,False)
66  lumidataTab.insertColumn( 'RUNNUM', 'unsigned int')
67  lumidataTab.insertColumn( 'NOMINALEGEV', 'float')
68  lumidataTab.setPrimaryKey( 'DATA_ID' )
69  db.createTable(lumidataTab,withIdTable=True,withEntryTables=True,withRevMapTable=True)
70  created.append(nameDealer.lumidataTableName())
71 
72  if not schema.existsTable(nameDealer.lumisummaryv2TableName() ):
73  print 'creating lumisummaryv2 table'
74  summary=coral.TableDescription()
75  summary.setName( nameDealer.lumisummaryv2TableName() )
76  summary.insertColumn('DATA_ID','unsigned long long')
77  summary.insertColumn('RUNNUM','unsigned int')
78  summary.insertColumn('LUMILSNUM','unsigned int')
79  summary.insertColumn('CMSLSNUM','unsigned int')
80  summary.insertColumn('INSTLUMI','float')
81  summary.insertColumn('INSTLUMIERROR','float')
82  summary.insertColumn('INSTLUMIQUALITY','short')
83  summary.insertColumn('BEAMSTATUS','string',28,False)
84  summary.insertColumn('BEAMENERGY','float')
85  summary.insertColumn('NUMORBIT','unsigned int')
86  summary.insertColumn('STARTORBIT','unsigned int')
87  summary.insertColumn('CMSBXINDEXBLOB','blob')
88  summary.insertColumn('BEAMINTENSITYBLOB_1','blob')
89  summary.insertColumn('BEAMINTENSITYBLOB_2','blob')
90  summary.insertColumn('BXLUMIVALUE_OCC1','blob')
91  summary.insertColumn('BXLUMIVALUE_OCC2','blob')
92  summary.insertColumn('BXLUMIVALUE_ET','blob')
93  summary.insertColumn('BXLUMIERROR_OCC1','blob')
94  summary.insertColumn('BXLUMIERROR_OCC2','blob')
95  summary.insertColumn('BXLUMIERROR_ET','blob')
96  summary.insertColumn('BXLUMIQUALITY_OCC1','blob')
97  summary.insertColumn('BXLUMIQUALITY_OCC2','blob')
98  summary.insertColumn('BXLUMIQUALITY_ET','blob')
99  summary.setPrimaryKey(('DATA_ID','LUMILSNUM'))
100  db.createTable(summary,withIdTable=False)
101  created.append(nameDealer.lumisummaryv2TableName())
102 
103  #
104  # This table exists in the old schema
105  #
106  if not schema.existsTable(nameDealer.cmsrunsummaryTableName()):
107  print 'creating cmsrunsummary table'
108  cmsrunsummary=coral.TableDescription()
109  cmsrunsummary.setName( nameDealer.cmsrunsummaryTableName() )
110  cmsrunsummary.insertColumn('RUNNUM','unsigned int')
111  cmsrunsummary.insertColumn('HLTKEY','string',128,False)
112  cmsrunsummary.insertColumn('L1KEY','string',128,False)
113  cmsrunsummary.insertColumn('FILLNUM','unsigned int')
114  cmsrunsummary.insertColumn('SEQUENCE','string',56,False)
115  cmsrunsummary.insertColumn('STARTTIME','time stamp',6)
116  cmsrunsummary.insertColumn('STOPTIME','time stamp',6)
117  cmsrunsummary.insertColumn('EGEV','unsigned int')
118  cmsrunsummary.insertColumn('AMODETAG','string',28,False)
119  cmsrunsummary.insertColumn('FILLSCHEME','string',128,False)
120  cmsrunsummary.insertColumn('NCOLLIDINGBUNCHES','usigned int')
121  cmsrunsummary.setPrimaryKey('RUNNUM')
122  db.createTable(cmsrunsummary,withIdTable=False)
123  created.append(nameDealer.cmsrunsummaryTableName())
124  #
125  # This table exists in the old schema
126  #
127  if not schema.existsTable(nameDealer.trghltMapTableName()):
128  print 'creating trghltmap table'
129  trghlt=coral.TableDescription()
130  trghlt.setName( nameDealer.trghltMapTableName() )
131  trghlt.insertColumn( 'HLTKEY','string',128,False )
132  trghlt.insertColumn( 'HLTPATHNAME','string',256,False )
133  trghlt.insertColumn( 'L1SEED','string' ,1024,False)
134  trghlt.setNotNullConstraint('HLTKEY',True)
135  trghlt.setNotNullConstraint('HLTPATHNAME',True)
136  trghlt.setNotNullConstraint('L1SEED',True)
137  db.createTable(trghlt,withIdTable=False)
138  created.append(nameDealer.trghltMapTableName())
139  if not schema.existsTable(nameDealer.trgdataTableName()):
140  print 'creating trgdata table'
141  trgdataTab=coral.TableDescription()
142  trgdataTab.setName( nameDealer.trgdataTableName() )
143  trgdataTab.insertColumn( 'DATA_ID','unsigned long long')
144  trgdataTab.insertColumn( 'ENTRY_ID','unsigned long long')
145  trgdataTab.insertColumn( 'ENTRY_NAME','string',56,False)
146  trgdataTab.insertColumn( 'SOURCE', 'string',128,False)
147  trgdataTab.insertColumn( 'RUNNUM', 'unsigned int')
148  trgdataTab.insertColumn( 'BITZERONAME', 'string',56,False)
149  trgdataTab.insertColumn( 'BITNAMECLOB', 'string',6000)
150  trgdataTab.setPrimaryKey( 'DATA_ID' )
151  db.createTable(trgdataTab,withIdTable=True,withEntryTables=True,withRevMapTable=True)
152  created.append(nameDealer.trgdataTableName())
153  if not schema.existsTable(nameDealer.lstrgTableName()):
154  print 'creating lstrg table'
155  lstrgTab=coral.TableDescription()
156  lstrgTab.setName( nameDealer.lstrgTableName() )
157  lstrgTab.insertColumn( 'DATA_ID','unsigned long long')
158  lstrgTab.insertColumn( 'RUNNUM', 'unsigned int')
159  lstrgTab.insertColumn( 'CMSLSNUM', 'unsigned int')
160  lstrgTab.insertColumn( 'DEADTIMECOUNT', 'unsigned long long')
161  lstrgTab.insertColumn( 'BITZEROCOUNT', 'unsigned int')
162  lstrgTab.insertColumn( 'BITZEROPRESCALE', 'unsigned int')
163  lstrgTab.insertColumn( 'DEADFRAC', 'float')
164  lstrgTab.insertColumn( 'PRESCALEBLOB', 'blob')
165  lstrgTab.insertColumn( 'TRGCOUNTBLOB', 'blob')
166  lstrgTab.setPrimaryKey( ('DATA_ID','CMSLSNUM') )
167  db.createTable(lstrgTab,withIdTable=False)
168  created.append( nameDealer.lstrgTableName() )
169 
170  if not schema.existsTable(nameDealer.hltdataTableName()):
171  print 'creating hltdata table'
172  hltdataTab=coral.TableDescription()
173  hltdataTab.setName( nameDealer.hltdataTableName() )
174  hltdataTab.insertColumn( 'DATA_ID','unsigned long long')
175  hltdataTab.insertColumn( 'ENTRY_ID','unsigned long long')
176  hltdataTab.insertColumn( 'ENTRY_NAME','string',56,False)
177  hltdataTab.insertColumn( 'RUNNUM', 'unsigned int')
178  hltdataTab.insertColumn( 'SOURCE', 'string',128,False)
179  hltdataTab.insertColumn( 'NPATH', 'unsigned int')
180  hltdataTab.insertColumn( 'PATHNAMECLOB', 'string',6000)
181  hltdataTab.setPrimaryKey( 'DATA_ID' )
182  db.createTable(hltdataTab,withIdTable=True,withEntryTables=True,withRevMapTable=True)
183  created.append(nameDealer.hltTableName())
184 
185  if not schema.existsTable(nameDealer.lshltTableName()):
186  print 'creating lshlt table'
187  lshltTab=coral.TableDescription()
188  lshltTab.setName( nameDealer.lshltTableName() )
189  lshltTab.insertColumn( 'DATA_ID','unsigned long long')
190  lshltTab.insertColumn( 'RUNNUM', 'unsigned int')
191  lshltTab.insertColumn( 'CMSLSNUM', 'unsigned int')
192  lshltTab.insertColumn( 'PRESCALEBLOB', 'blob')
193  lshltTab.insertColumn( 'HLTCOUNTBLOB', 'blob')
194  lshltTab.insertColumn( 'HLTACCEPTBLOB', 'blob')
195  db.createTable(lshltTab,withIdTable=False)
196  lshltTab.setPrimaryKey( ('DATA_ID','CMSLSNUM') )
197  created.append(nameDealer.lshltTableName())
198 
199 
200  if not schema.existsTable(nameDealer.lumivalidationTableName()):
201  print 'creating lumivalidation table'
202  lumivalidation=coral.TableDescription()
203  lumivalidation.setName( nameDealer.lumivalidationTableName() )
204  lumivalidation.insertColumn( 'RUNNUM','unsigned int' )
205  lumivalidation.insertColumn( 'CMSLSNUM','unsigned int' )
206  lumivalidation.insertColumn( 'FLAG','string',28,False )
207  lumivalidation.insertColumn( 'COMMENT','string',1024,False )
208  lumivalidation.setPrimaryKey( ('RUNNUM','CMSLSNUM') )
209  lumivalidation.setNotNullConstraint('FLAG',True)
210  db.createTable(lumivalidation,withIdTable=False)
211  created.append(nameDealer.lumivalidationTableName())
212  return created
213  except :
214  raise
215 
216 
217 #=======================================================
218 #
219 # DROP
220 #
221 #=======================================================
def createTables(schema)
Definition: lumidbDDL.py:8
def lumisummaryv2TableName()
Definition: nameDealer.py:28
def luminormTableName()
Definition: nameDealer.py:37
def lumivalidationTableName()
Definition: nameDealer.py:85
def lshltTableName()
Definition: nameDealer.py:61
def revisionTableName()
Definition: nameDealer.py:11
def lstrgTableName()
Definition: nameDealer.py:49
def trgdataTableName()
Definition: nameDealer.py:46
def hltTableName()
Definition: nameDealer.py:55
def fillschemeTableName()
Definition: nameDealer.py:13
def hltdataTableName()
Definition: nameDealer.py:58
def cmsrunsummaryTableName()
Definition: nameDealer.py:16
def trghltMapTableName()
Definition: nameDealer.py:76
def lumidataTableName()
Definition: nameDealer.py:19
def lumidbDDL.createUniqueConstraints (   schema)
 

Definition at line 469 of file lumidbDDL.py.

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

Definition at line 482 of file lumidbDDL.py.

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

Definition at line 445 of file lumidbDDL.py.

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

Definition at line 453 of file lumidbDDL.py.

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

Definition at line 441 of file lumidbDDL.py.

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

Definition at line 464 of file lumidbDDL.py.

465  '''
466  '''
467  pass
468 
def dropNULLConstraints(schema)
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().

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

Definition at line 477 of file lumidbDDL.py.

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

Definition at line 413 of file lumidbDDL.py.

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

Referenced by PrimaryVertexSorter< ParticlesCollection >.produce().

413 def newToOld(schema):
414  try:
415  dropTables(schema,['REVISIONS','LUMINORMS','LUMIDATA','LUMISUMMARYV2','TRGDATA','LSTRG','HLTDATA','LSHLT'])
416  tableHandle=schema.tableHandle(nameDealer.cmsrunsummaryTableName())
417  ncol=tableHandle.description().numberOfColumns()
418  todrop=[]
419  for i in range(ncol):
420  colname=tableHandle.description().columnDescription(i).name()
421  if colname in ['L1KEY','EGEV','AMODETAG']:
422  todrop.append(colname)
423  for colname in todrop:
424  tableHandle.schemaEditor().dropColumn(colname)
425  except :
426  raise
427 
428 #=======================================================
429 #
430 # TODO
431 #
432 #=======================================================
433 
def dropTables(schema, tablelist)
Definition: lumidbDDL.py:222
def cmsrunsummaryTableName()
Definition: nameDealer.py:16
def newToOld(schema)
Definition: lumidbDDL.py:413
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().

Referenced by PrimaryVertexSorter< ParticlesCollection >.produce().

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

Variable Documentation

lumidbDDL.authpath

Definition at line 490 of file lumidbDDL.py.

lumidbDDL.cpp2sqltype

Definition at line 493 of file lumidbDDL.py.

lumidbDDL.debugON

Definition at line 492 of file lumidbDDL.py.

lumidbDDL.False

Definition at line 493 of file lumidbDDL.py.

lumidbDDL.isReadOnly

Definition at line 493 of file lumidbDDL.py.

lumidbDDL.myconstr

Definition at line 489 of file lumidbDDL.py.

lumidbDDL.schema

Definition at line 494 of file lumidbDDL.py.

lumidbDDL.session

Definition at line 493 of file lumidbDDL.py.

lumidbDDL.svc

Definition at line 492 of file lumidbDDL.py.

lumidbDDL.tables

Definition at line 496 of file lumidbDDL.py.