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 452 of file lumidbDDL.py.

453  '''
454  '''
455  pass
def createFKConstraints(schema)
Definition: lumidbDDL.py:452
def lumidbDDL.createIndices (   schema)
 

Definition at line 437 of file lumidbDDL.py.

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

Definition at line 460 of file lumidbDDL.py.

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

Definition at line 239 of file lumidbDDL.py.

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

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

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

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

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

Definition at line 485 of file lumidbDDL.py.

485 def describe(schema):
486  '''
487  '''
488  pass
489 
def describe(schema)
Definition: lumidbDDL.py:485
def lumidbDDL.describeIndices (   schema)
 

Definition at line 448 of file lumidbDDL.py.

448 def describeIndices(schema):
449  '''
450  '''
451  pass
def describeIndices(schema)
Definition: lumidbDDL.py:448
def lumidbDDL.dropFKConstrains (   schema)
 

Definition at line 456 of file lumidbDDL.py.

456 def dropFKConstrains(schema):
457  '''
458  '''
459  pass
def dropFKConstrains(schema)
Definition: lumidbDDL.py:456
def lumidbDDL.dropIndices (   schema)
 

Definition at line 444 of file lumidbDDL.py.

444 def dropIndices(schema):
445  '''
446  '''
447  pass
def dropIndices(schema)
Definition: lumidbDDL.py:444
def lumidbDDL.dropNULLConstraints (   schema)
 

Definition at line 467 of file lumidbDDL.py.

468  '''
469  '''
470  pass
471 
def dropNULLConstraints(schema)
Definition: lumidbDDL.py:467
def lumidbDDL.dropTables (   schema,
  tablelist 
)

Definition at line 225 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().

225 def dropTables(schema,tablelist):
226  try:
227  db=dbUtil.dbUtil(schema)
228  for tablename in tablelist:
230  db.dropTable( nameDealer.idTableName(tablename) )
231  db.dropTable( nameDealer.entryTableName(tablename) )
232  db.dropTable( nameDealer.revmapTableName(tablename) )
234  db.dropTable( nameDealer.idTableName(tablename) )
235  db.dropTable( tablename )
236  except :
237  raise
238 
def dropTables(schema, tablelist)
Definition: lumidbDDL.py:225
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 480 of file lumidbDDL.py.

481  '''
482  '''
483  pass
484 
def dropUNIQUEConstraints(schema)
Definition: lumidbDDL.py:480
def lumidbDDL.newToOld (   schema)

Definition at line 416 of file lumidbDDL.py.

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

Referenced by PFCandidateMuonUntagger.produce(), PrimaryVertexSorter< ParticlesCollection >.produce(), and PFCandidateRecalibrator.produce().

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

Definition at line 402 of file lumidbDDL.py.

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

Referenced by PFCandidateMuonUntagger.produce(), PrimaryVertexSorter< ParticlesCollection >.produce(), and PFCandidateRecalibrator.produce().

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

Variable Documentation

lumidbDDL.authpath

Definition at line 493 of file lumidbDDL.py.

lumidbDDL.cpp2sqltype

Definition at line 496 of file lumidbDDL.py.

lumidbDDL.debugON

Definition at line 495 of file lumidbDDL.py.

lumidbDDL.False

Definition at line 496 of file lumidbDDL.py.

lumidbDDL.isReadOnly

Definition at line 496 of file lumidbDDL.py.

lumidbDDL.myconstr

Definition at line 492 of file lumidbDDL.py.

lumidbDDL.schema

Definition at line 497 of file lumidbDDL.py.

lumidbDDL.session

Definition at line 496 of file lumidbDDL.py.

lumidbDDL.svc

Definition at line 495 of file lumidbDDL.py.

lumidbDDL.tables

Definition at line 499 of file lumidbDDL.py.