CMS 3D CMS Logo

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.

00450                                :
00451     '''
00452     '''
    pass
def lumidbDDL::createIndices (   schema)

Definition at line 434 of file lumidbDDL.py.

00435                          :
00436     '''
00437     '''
00438     pass
00439     #cmsrunsummary.createIndex('cmsrunsummary_fillnum',('FILLNUM'))
00440     #cmsrunsummary.createIndex('cmsrunsummary_startime',('STARTTIME'))

def lumidbDDL::createNULLConstraints (   schema)

Definition at line 457 of file lumidbDDL.py.

00458                                  :
00459     '''
00460     '''
00461     #cmsrunsummary.setNotNullConstraint('HLTKEY',True)
00462     #cmsrunsummary.setNotNullConstraint('FILLNUM',True)
00463     #cmsrunsummary.setNotNullConstraint('SEQUENCE',True)
    pass
def lumidbDDL::createOldSchema (   schema)
create tables of lumidb1 if not exist

Definition at line 236 of file lumidbDDL.py.

00237                            :
00238     '''
00239     create tables of lumidb1 if not exist
00240     '''
00241     try:
00242         created=[]
00243         db=dbUtil.dbUtil(schema)
00244         if not schema.existsTable(nameDealer.lumivalidationTableName()):
00245             lumivalidation=coral.TableDescription()
00246             lumivalidation.setName( nameDealer.lumivalidationTableName() )
00247             lumivalidation.insertColumn( 'RUNNUM','unsigned int' )
00248             lumivalidation.insertColumn( 'CMSLSNUM','unsigned int' )
00249             lumivalidation.insertColumn( 'FLAG','string',28,False )
00250             lumivalidation.insertColumn( 'COMMENT','string',1024,False )
00251             lumivalidation.setPrimaryKey(('RUNNUM','CMSLSNUM'))
00252             lumivalidation.setNotNullConstraint('FLAG',True)
00253             db.createTable(lumivalidation,withIdTable=False)
00254             created.append(nameDealer.lumivalidationTableName())
00255             
00256         if not schema.existsTable(nameDealer.cmsrunsummaryTableName()):
00257             cmsrunsummary=coral.TableDescription()
00258             cmsrunsummary.setName( nameDealer.cmsrunsummaryTableName() )
00259             cmsrunsummary.insertColumn('RUNNUM','unsigned int')
00260             cmsrunsummary.insertColumn('HLTKEY','string',128,False)
00261             cmsrunsummary.insertColumn('FILLNUM','unsigned int')
00262             cmsrunsummary.insertColumn('SEQUENCE','string',56,False)
00263             cmsrunsummary.insertColumn('STARTTIME','time stamp',6)
00264             cmsrunsummary.insertColumn('STOPTIME','time stamp',6)
00265             cmsrunsummary.setPrimaryKey('RUNNUM')
00266             cmsrunsummary.setNotNullConstraint('HLTKEY',True)
00267             cmsrunsummary.setNotNullConstraint('FILLNUM',True)
00268             cmsrunsummary.setNotNullConstraint('SEQUENCE',True)
00269             cmsrunsummary.createIndex('cmsrunsummary_fillnum',('FILLNUM'))
00270             cmsrunsummary.createIndex('cmsrunsummary_startime',('STARTTIME'))
00271             db.createTable(cmsrunsummary,withIdTable=False)
00272             created.append(nameDealer.cmsrunsummaryTableName())
00273             
00274         if not schema.existsTable(nameDealer.lumisummaryTableName()):
00275             summary=coral.TableDescription()
00276             summary.setName( nameDealer.lumisummaryTableName() )
00277             summary.insertColumn('LUMISUMMARY_ID','unsigned long long')
00278             summary.insertColumn('RUNNUM','unsigned int')
00279             summary.insertColumn('CMSLSNUM','unsigned int')
00280             summary.insertColumn('LUMILSNUM','unsigned int')
00281             summary.insertColumn('LUMIVERSION','string',28,False)
00282             summary.insertColumn('DTNORM','float')
00283             summary.insertColumn('LHCNORM','float')
00284             summary.insertColumn('CMSALIVE','short')
00285             summary.insertColumn('INSTLUMI','float')
00286             summary.insertColumn('INSTLUMIERROR','float')
00287             summary.insertColumn('INSTLUMIQUALITY','short')
00288             summary.insertColumn('BEAMSTATUS','string',28,False)
00289             summary.insertColumn('BEAMENERGY','float')
00290             summary.insertColumn('NUMORBIT','unsigned int')
00291             summary.insertColumn('STARTORBIT','unsigned int')
00292             summary.insertColumn('LUMISECTIONQUALITY','short')
00293             summary.insertColumn('CMSBXINDEXBLOB','blob')
00294             summary.insertColumn('BEAMINTENSITYBLOB_1','blob')
00295             summary.insertColumn('BEAMINTENSITYBLOB_2','blob')           
00296             summary.setPrimaryKey('LUMISUMMARY_ID')
00297             summary.setNotNullConstraint('RUNNUM',True)
00298             summary.setNotNullConstraint('CMSLSNUM',True)
00299             summary.setNotNullConstraint('LUMILSNUM',True)
00300             summary.setNotNullConstraint('CMSALIVE',True)
00301             summary.setNotNullConstraint('LUMIVERSION',True)
00302             summary.setNotNullConstraint('DTNORM',True)
00303             summary.setNotNullConstraint('LHCNORM',True)
00304             summary.setNotNullConstraint('INSTLUMI',True)
00305             summary.setNotNullConstraint('INSTLUMIERROR',True)
00306             summary.setNotNullConstraint('INSTLUMIQUALITY',True)
00307             summary.setNotNullConstraint('STARTORBIT',True)
00308             summary.setNotNullConstraint('NUMORBIT',True)
00309             summary.setNotNullConstraint('LUMISECTIONQUALITY',True)
00310             summary.setNotNullConstraint('BEAMENERGY',True)
00311             summary.setNotNullConstraint('BEAMSTATUS',True)
00312             summary.setUniqueConstraint(('RUNNUM','LUMIVERSION','LUMILSNUM'))
00313             summary.createIndex('lumisummary_runnum',('RUNNUM'))
00314             db.createTable(summary,withIdTable=True)
00315             created.append(nameDealer.lumisummaryTableName())
00316             
00317         if not schema.existsTable(nameDealer.lumidetailTableName()):
00318             detail=coral.TableDescription()
00319             detail.setName( nameDealer.lumidetailTableName() )
00320             detail.insertColumn('LUMIDETAIL_ID','unsigned long long')
00321             detail.insertColumn('LUMISUMMARY_ID','unsigned long long')
00322             detail.insertColumn('BXLUMIVALUE','blob')
00323             detail.insertColumn('BXLUMIERROR','blob')
00324             detail.insertColumn('BXLUMIQUALITY','blob')
00325             detail.insertColumn('ALGONAME','string',28,False)
00326             detail.setPrimaryKey('LUMIDETAIL_ID')
00327             detail.createForeignKey('DETAILSOURCE','LUMISUMMARY_ID',nameDealer.lumisummaryTableName(),'LUMISUMMARY_ID')
00328             detail.setNotNullConstraint('BXLUMIVALUE',True)
00329             detail.setNotNullConstraint('BXLUMIERROR',True)
00330             detail.setNotNullConstraint('BXLUMIQUALITY',True)
00331             detail.setNotNullConstraint('ALGONAME',True)
00332             detail.setUniqueConstraint(('LUMISUMMARY_ID','ALGONAME'))
00333             db.createTable(detail,withIdTable=True)
00334             created.append(nameDealer.lumidetailTableName())
00335             
00336         if  not schema.existsTable(nameDealer.trgTableName()):
00337             trg=coral.TableDescription()
00338             trg.setName( nameDealer.trgTableName() )
00339             trg.insertColumn('TRG_ID','unsigned long long')
00340             trg.insertColumn('RUNNUM','unsigned int')
00341             trg.insertColumn('CMSLSNUM','unsigned int')
00342             trg.insertColumn('BITNUM','unsigned int')
00343             trg.insertColumn('BITNAME','string',56,False)
00344             trg.insertColumn('TRGCOUNT','unsigned int')
00345             trg.insertColumn('DEADTIME','unsigned long long')
00346             trg.insertColumn('PRESCALE','unsigned int')
00347             trg.setNotNullConstraint('RUNNUM',True)
00348             trg.setNotNullConstraint('CMSLSNUM',True)
00349             trg.setNotNullConstraint('BITNUM',True)
00350             trg.setNotNullConstraint('BITNAME',True)
00351             trg.setNotNullConstraint('TRGCOUNT',True)
00352             trg.setNotNullConstraint('DEADTIME',True)
00353             trg.setNotNullConstraint('PRESCALE',True)
00354             trg.setPrimaryKey('TRG_ID')
00355             trg.createIndex('trg_runnum',('RUNNUM'))        
00356             db.createTable(trg,withIdTable=True)
00357             created.append( nameDealer.trgTableName() )
00358 
00359         if not schema.existsTable( nameDealer.hltTableName() ): 
00360             hlt=coral.TableDescription()
00361             hlt.setName( nameDealer.hltTableName() )
00362             hlt.insertColumn( 'HLT_ID','unsigned long long')
00363             hlt.insertColumn( 'RUNNUM','unsigned int')
00364             hlt.insertColumn( 'CMSLSNUM','unsigned int')
00365             hlt.insertColumn( 'PATHNAME','string',256,False)
00366             hlt.insertColumn( 'INPUTCOUNT','unsigned int')
00367             hlt.insertColumn( 'ACCEPTCOUNT','unsigned int')
00368             hlt.insertColumn( 'PRESCALE','unsigned int')
00369             hlt.setPrimaryKey( 'HLT_ID' )
00370             hlt.setNotNullConstraint('RUNNUM',True)
00371             hlt.setNotNullConstraint('CMSLSNUM',True)
00372             hlt.setNotNullConstraint('PATHNAME',True)
00373             hlt.setNotNullConstraint('INPUTCOUNT',True)
00374             hlt.setNotNullConstraint('ACCEPTCOUNT',True)
00375             hlt.setNotNullConstraint('PRESCALE',True)
00376             hlt.createIndex('hlt_runnum',('RUNNUM'))
00377             db.createTable(hlt,withIdTable=True)
00378             created.append( nameDealer.hltTableName() )
00379             
00380         if not schema.existsTable( nameDealer.trghltMapTableName() ): 
00381             trghlt=coral.TableDescription()
00382             trghlt.setName( nameDealer.trghltMapTableName() )
00383             trghlt.insertColumn( 'HLTKEY','string',128,False )
00384             trghlt.insertColumn( 'HLTPATHNAME','string',256,False )
00385             trghlt.insertColumn( 'L1SEED','string',1024,false )
00386             trghlt.setNotNullConstraint('HLTKEY',True)
00387             trghlt.setNotNullConstraint('HLTPATHNAME',True)
00388             trghlt.setNotNullConstraint('L1SEED',True)
00389             db.createTable(trghlt,withIdTable=False)
00390             created.append( nameDealer.trghltMapTableName() )
00391         return created
00392     except:
00393         raise
00394         
00395 #=======================================================
00396 #
00397 #   MODIFY
00398 #
#=======================================================
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.

00009                         :
00010     '''
00011     create new tables if not exist
00012     revisions,revisions_id,luminorms,luminorms_entries,luminorms_entries_id,fillscheme
00013     '''
00014     try:
00015         created=[]
00016         db=dbUtil.dbUtil(schema)
00017         if not schema.existsTable(nameDealer.fillschemeTableName()):
00018             print 'creating fillscheme table'
00019             fillschemeTab=coral.TableDescription()
00020             fillschemeTab.setName( nameDealer.fillschemeTableName() )
00021             fillschemeTab.insertColumn( 'FILLSCHEME_ID','unsigned long long' )
00022             fillschemeTab.insertColumn( 'FILLSCHEMEPATTERN','string',128,False )
00023             fillschemeTab.insertColumn( 'CORRECTIONFACTOR','float' )
00024             fillschemeTab.setPrimaryKey( 'FILLSCHEME_ID' )
00025             db.createTable(fillschemeTab,withIdTable=True)
00026             created.append( nameDealer.fillschemeTableName() )
00027             
00028         if not schema.existsTable(nameDealer.revisionTableName()):
00029             print 'creating revisions table'
00030             revisionsTab=coral.TableDescription()
00031             revisionsTab.setName( nameDealer.revisionTableName() )
00032             revisionsTab.insertColumn( 'REVISION_ID','unsigned long long')
00033             revisionsTab.insertColumn( 'BRANCH_ID','unsigned long long')
00034             revisionsTab.insertColumn( 'NAME', 'string',56,False)
00035             revisionsTab.insertColumn( 'BRANCH_NAME', 'string',56,False)
00036             revisionsTab.insertColumn( 'COMMENT', 'string',1024,False)
00037             revisionsTab.insertColumn( 'CTIME', 'time stamp',6)
00038             revisionsTab.setPrimaryKey( 'REVISION_ID' )
00039             revisionsTab.setUniqueConstraint(('NAME'))
00040             db.createTable(revisionsTab,withIdTable=True)
00041             created.append(nameDealer.revisionTableName())
00042             
00043         if not schema.existsTable(nameDealer.luminormTableName()):
00044             print 'creating luminorms table'
00045             luminormsTab=coral.TableDescription()
00046             luminormsTab.setName( nameDealer.luminormTableName() )
00047             luminormsTab.insertColumn( 'DATA_ID','unsigned long long')
00048             luminormsTab.insertColumn( 'ENTRY_ID','unsigned long long')
00049             luminormsTab.insertColumn( 'ENTRY_NAME','string',56,False)
00050             luminormsTab.insertColumn( 'AMODETAG', 'string',28,False)
00051             luminormsTab.insertColumn( 'NORM_1', 'float')
00052             luminormsTab.insertColumn( 'EGEV_1', 'unsigned int')
00053             luminormsTab.insertColumn( 'NORM_2', 'float')
00054             luminormsTab.insertColumn( 'EGEV_2', 'unsigned int')
00055             luminormsTab.setPrimaryKey( 'DATA_ID' )
00056             db.createTable(luminormsTab,withIdTable=True,withEntryTables=True,withRevMapTable=True)
00057             created.append(nameDealer.luminormTableName())
00058   
00059         if not schema.existsTable(nameDealer.lumidataTableName()):
00060             print 'creating lumidata table'
00061             lumidataTab=coral.TableDescription()
00062             lumidataTab.setName( nameDealer.lumidataTableName() )
00063             lumidataTab.insertColumn( 'DATA_ID','unsigned long long')
00064             lumidataTab.insertColumn( 'ENTRY_ID','unsigned long long')
00065             lumidataTab.insertColumn( 'ENTRY_NAME','string',56,False)
00066             lumidataTab.insertColumn( 'SOURCE', 'string',128,False)
00067             lumidataTab.insertColumn( 'RUNNUM', 'unsigned int')
00068             lumidataTab.insertColumn( 'NOMINALEGEV', 'float')
00069             lumidataTab.setPrimaryKey( 'DATA_ID' )
00070             db.createTable(lumidataTab,withIdTable=True,withEntryTables=True,withRevMapTable=True)
00071             created.append(nameDealer.lumidataTableName())
00072 
00073         if not schema.existsTable(nameDealer.lumisummaryv2TableName() ):
00074             print 'creating lumisummaryv2 table'
00075             summary=coral.TableDescription()
00076             summary.setName( nameDealer.lumisummaryv2TableName() )
00077             summary.insertColumn('DATA_ID','unsigned long long')
00078             summary.insertColumn('RUNNUM','unsigned int')
00079             summary.insertColumn('LUMILSNUM','unsigned int')
00080             summary.insertColumn('CMSLSNUM','unsigned int')
00081             summary.insertColumn('INSTLUMI','float')
00082             summary.insertColumn('INSTLUMIERROR','float')
00083             summary.insertColumn('INSTLUMIQUALITY','short')
00084             summary.insertColumn('BEAMSTATUS','string',28,False)
00085             summary.insertColumn('BEAMENERGY','float')
00086             summary.insertColumn('NUMORBIT','unsigned int')
00087             summary.insertColumn('STARTORBIT','unsigned int')
00088             summary.insertColumn('CMSBXINDEXBLOB','blob')
00089             summary.insertColumn('BEAMINTENSITYBLOB_1','blob')
00090             summary.insertColumn('BEAMINTENSITYBLOB_2','blob')
00091             summary.insertColumn('BXLUMIVALUE_OCC1','blob')
00092             summary.insertColumn('BXLUMIVALUE_OCC2','blob')
00093             summary.insertColumn('BXLUMIVALUE_ET','blob')
00094             summary.insertColumn('BXLUMIERROR_OCC1','blob')
00095             summary.insertColumn('BXLUMIERROR_OCC2','blob')
00096             summary.insertColumn('BXLUMIERROR_ET','blob')
00097             summary.insertColumn('BXLUMIQUALITY_OCC1','blob')
00098             summary.insertColumn('BXLUMIQUALITY_OCC2','blob')
00099             summary.insertColumn('BXLUMIQUALITY_ET','blob')
00100             summary.setPrimaryKey(('DATA_ID','LUMILSNUM'))
00101             db.createTable(summary,withIdTable=False)            
00102             created.append(nameDealer.lumisummaryv2TableName())
00103             
00104         #
00105         # This table exists in the old schema
00106         #
00107         if not schema.existsTable(nameDealer.cmsrunsummaryTableName()):
00108             print 'creating cmsrunsummary table'
00109             cmsrunsummary=coral.TableDescription()
00110             cmsrunsummary.setName( nameDealer.cmsrunsummaryTableName() )
00111             cmsrunsummary.insertColumn('RUNNUM','unsigned int')
00112             cmsrunsummary.insertColumn('HLTKEY','string',128,False)
00113             cmsrunsummary.insertColumn('L1KEY','string',128,False)
00114             cmsrunsummary.insertColumn('FILLNUM','unsigned int')
00115             cmsrunsummary.insertColumn('SEQUENCE','string',56,False)
00116             cmsrunsummary.insertColumn('STARTTIME','time stamp',6)
00117             cmsrunsummary.insertColumn('STOPTIME','time stamp',6)
00118             cmsrunsummary.insertColumn('EGEV','unsigned int')
00119             cmsrunsummary.insertColumn('AMODETAG','string',28,False)
00120             cmsrunsummary.insertColumn('FILLSCHEME','string',128,False)
00121             cmsrunsummary.insertColumn('NCOLLIDINGBUNCHES','usigned int')
00122             cmsrunsummary.setPrimaryKey('RUNNUM')
00123             db.createTable(cmsrunsummary,withIdTable=False)
00124             created.append(nameDealer.cmsrunsummaryTableName())
00125         #
00126         #  This table exists in the old schema
00127         #
00128         if not schema.existsTable(nameDealer.trghltMapTableName()):
00129             print 'creating trghltmap table'
00130             trghlt=coral.TableDescription()
00131             trghlt.setName( nameDealer.trghltMapTableName() )
00132             trghlt.insertColumn( 'HLTKEY','string',128,False )
00133             trghlt.insertColumn( 'HLTPATHNAME','string',256,False )
00134             trghlt.insertColumn( 'L1SEED','string' ,1024,False)
00135             trghlt.setNotNullConstraint('HLTKEY',True)
00136             trghlt.setNotNullConstraint('HLTPATHNAME',True)
00137             trghlt.setNotNullConstraint('L1SEED',True)
00138             db.createTable(trghlt,withIdTable=False)
00139             created.append(nameDealer.trghltMapTableName())      
00140         if not schema.existsTable(nameDealer.trgdataTableName()):
00141             print 'creating trgdata table'
00142             trgdataTab=coral.TableDescription()
00143             trgdataTab.setName( nameDealer.trgdataTableName() )
00144             trgdataTab.insertColumn( 'DATA_ID','unsigned long long')
00145             trgdataTab.insertColumn( 'ENTRY_ID','unsigned long long')
00146             trgdataTab.insertColumn( 'ENTRY_NAME','string',56,False)
00147             trgdataTab.insertColumn( 'SOURCE', 'string',128,False)
00148             trgdataTab.insertColumn( 'RUNNUM', 'unsigned int')
00149             trgdataTab.insertColumn( 'BITZERONAME', 'string',56,False)
00150             trgdataTab.insertColumn( 'BITNAMECLOB', 'string',6000)
00151             trgdataTab.setPrimaryKey( 'DATA_ID' )
00152             db.createTable(trgdataTab,withIdTable=True,withEntryTables=True,withRevMapTable=True)
00153             created.append(nameDealer.trgdataTableName())
00154         if not schema.existsTable(nameDealer.lstrgTableName()):
00155             print 'creating lstrg table'
00156             lstrgTab=coral.TableDescription()
00157             lstrgTab.setName( nameDealer.lstrgTableName() )
00158             lstrgTab.insertColumn( 'DATA_ID','unsigned long long')
00159             lstrgTab.insertColumn( 'RUNNUM', 'unsigned int')
00160             lstrgTab.insertColumn( 'CMSLSNUM', 'unsigned int')
00161             lstrgTab.insertColumn( 'DEADTIMECOUNT', 'unsigned long long')
00162             lstrgTab.insertColumn( 'BITZEROCOUNT', 'unsigned int')
00163             lstrgTab.insertColumn( 'BITZEROPRESCALE', 'unsigned int')
00164             lstrgTab.insertColumn( 'DEADFRAC', 'float')
00165             lstrgTab.insertColumn( 'PRESCALEBLOB', 'blob')
00166             lstrgTab.insertColumn( 'TRGCOUNTBLOB', 'blob')
00167             lstrgTab.setPrimaryKey( ('DATA_ID','CMSLSNUM') )
00168             db.createTable(lstrgTab,withIdTable=False)            
00169             created.append( nameDealer.lstrgTableName() )
00170 
00171         if not schema.existsTable(nameDealer.hltdataTableName()):
00172             print 'creating hltdata table'
00173             hltdataTab=coral.TableDescription()
00174             hltdataTab.setName( nameDealer.hltdataTableName() )
00175             hltdataTab.insertColumn( 'DATA_ID','unsigned long long')
00176             hltdataTab.insertColumn( 'ENTRY_ID','unsigned long long')
00177             hltdataTab.insertColumn( 'ENTRY_NAME','string',56,False)
00178             hltdataTab.insertColumn( 'RUNNUM', 'unsigned int')
00179             hltdataTab.insertColumn( 'SOURCE', 'string',128,False)
00180             hltdataTab.insertColumn( 'NPATH', 'unsigned int')
00181             hltdataTab.insertColumn( 'PATHNAMECLOB', 'string',6000)
00182             hltdataTab.setPrimaryKey( 'DATA_ID' )
00183             db.createTable(hltdataTab,withIdTable=True,withEntryTables=True,withRevMapTable=True)
00184             created.append(nameDealer.hltTableName())
00185             
00186         if not schema.existsTable(nameDealer.lshltTableName()):
00187             print 'creating lshlt table'
00188             lshltTab=coral.TableDescription()
00189             lshltTab.setName( nameDealer.lshltTableName() )
00190             lshltTab.insertColumn( 'DATA_ID','unsigned long long')
00191             lshltTab.insertColumn( 'RUNNUM', 'unsigned int')
00192             lshltTab.insertColumn( 'CMSLSNUM', 'unsigned int')
00193             lshltTab.insertColumn( 'PRESCALEBLOB', 'blob')
00194             lshltTab.insertColumn( 'HLTCOUNTBLOB', 'blob')
00195             lshltTab.insertColumn( 'HLTACCEPTBLOB', 'blob')
00196             db.createTable(lshltTab,withIdTable=False)
00197             lshltTab.setPrimaryKey( ('DATA_ID','CMSLSNUM') )
00198             created.append(nameDealer.lshltTableName())          
00199 
00200             
00201         if not schema.existsTable(nameDealer.lumivalidationTableName()):
00202             print 'creating lumivalidation  table'
00203             lumivalidation=coral.TableDescription()
00204             lumivalidation.setName( nameDealer.lumivalidationTableName() )
00205             lumivalidation.insertColumn( 'RUNNUM','unsigned int' )
00206             lumivalidation.insertColumn( 'CMSLSNUM','unsigned int' )
00207             lumivalidation.insertColumn( 'FLAG','string',28,False )
00208             lumivalidation.insertColumn( 'COMMENT','string',1024,False )
00209             lumivalidation.setPrimaryKey( ('RUNNUM','CMSLSNUM') )
00210             lumivalidation.setNotNullConstraint('FLAG',True)
00211             db.createTable(lumivalidation,withIdTable=False)
00212             created.append(nameDealer.lumivalidationTableName())
00213         return created
00214     except :
00215         raise 
00216 
00217    
00218 #=======================================================
00219 #
00220 #   DROP
00221 #
#=======================================================    
def lumidbDDL::createUniqueConstraints (   schema)

Definition at line 469 of file lumidbDDL.py.

00470                                    :
00471     '''
00472     '''
00473     try:
00474         revtable=schema.tableHandle(nameDealer.revisionTableName())
00475         revtable.schemaEditor().setUniqueConstraint('NAME','revisions_name_uc')
00476     except:
        raise
def lumidbDDL::describe (   schema)

Definition at line 482 of file lumidbDDL.py.

00483                     :
00484     '''
00485     '''
00486     pass

def lumidbDDL::describeIndices (   schema)

Definition at line 445 of file lumidbDDL.py.

00446                            :
00447     '''
00448     '''
    pass
def lumidbDDL::dropFKConstrains (   schema)

Definition at line 453 of file lumidbDDL.py.

00454                             :
00455     '''
00456     '''
    pass
def lumidbDDL::dropIndices (   schema)

Definition at line 441 of file lumidbDDL.py.

00442                        :
00443     '''
00444     '''
    pass
def lumidbDDL::dropNULLConstraints (   schema)

Definition at line 464 of file lumidbDDL.py.

00465                                :
00466     '''
00467     '''
00468     pass

def lumidbDDL::dropTables (   schema,
  tablelist 
)

Definition at line 222 of file lumidbDDL.py.

00223                                 :
00224     try:
00225         db=dbUtil.dbUtil(schema)
00226         for tablename in tablelist:
00227             if tablename in [nameDealer.luminormTableName(),nameDealer.lumidataTableName(),nameDealer.trgdataTableName(),nameDealer.hltdataTableName()]:
00228                 db.dropTable( nameDealer.idTableName(tablename) )
00229                 db.dropTable( nameDealer.entryTableName(tablename) )
00230                 db.dropTable( nameDealer.revmapTableName(tablename) )            
00231             if tablename in [nameDealer.trgTableName(),nameDealer.lumisummaryTableName(),nameDealer.lumisummaryv2TableName(),nameDealer.lumidetailTableName(),nameDealer.hltTableName()]:
00232                 db.dropTable( nameDealer.idTableName(tablename) )
00233             db.dropTable( tablename )
00234     except :
00235         raise 
    
def lumidbDDL::dropUNIQUEConstraints (   schema)

Definition at line 477 of file lumidbDDL.py.

00478                                  :
00479     '''
00480     '''
00481     pass

def lumidbDDL::newToOld (   schema)

Definition at line 413 of file lumidbDDL.py.

00414                     :
00415     try:
00416         dropTables(schema,['REVISIONS','LUMINORMS','LUMIDATA','LUMISUMMARYV2','TRGDATA','LSTRG','HLTDATA','LSHLT'])
00417         tableHandle=schema.tableHandle(nameDealer.cmsrunsummaryTableName())
00418         ncol=tableHandle.description().numberOfColumns()
00419         todrop=[]
00420         for i in range(ncol):
00421             colname=tableHandle.description().columnDescription(i).name()
00422             if colname in ['L1KEY','EGEV','AMODETAG']:
00423                 todrop.append(colname)
00424         for colname in todrop:
00425             tableHandle.schemaEditor().dropColumn(colname)            
00426     except :
00427         raise 
00428 
00429 #=======================================================
00430 #
00431 #   TODO
00432 #
00433 #=======================================================   

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.

00400                     :
00401     '''
00402     modify old tables:cmsrunsummary
00403     alter table cmsrunsummary add column(l1key string,egev unsigned int,amodetag string)
00404     '''
00405     try:
00406         tableHandle=schema.tableHandle(nameDealer.cmsrunsummaryTableName())
00407         tableHandle.schemaEditor().insertColumn('L1KEY','string',128,False)
00408         tableHandle.schemaEditor().insertColumn('EGEV','unsigned int')
00409         tableHandle.schemaEditor().insertColumn('AMODETAG','string',28,False)
00410         createTables(schema)
00411     except:
00412         raise
    

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.

Definition at line 492 of file lumidbDDL.py.

tuple lumidbDDL::tables = createTables(schema)

Definition at line 496 of file lumidbDDL.py.