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) |
def lumidbDDL::createFKConstraints | ( | schema | ) |
def lumidbDDL::createIndices | ( | schema | ) |
Definition at line 421 of file lumidbDDL.py.
def lumidbDDL::createNULLConstraints | ( | schema | ) |
Definition at line 444 of file lumidbDDL.py.
def lumidbDDL::createOldSchema | ( | schema | ) |
create tables of lumidb1 if not exist
Definition at line 223 of file lumidbDDL.py.
00224 : 00225 ''' 00226 create tables of lumidb1 if not exist 00227 ''' 00228 try: 00229 created=[] 00230 db=dbUtil.dbUtil(schema) 00231 if not schema.existsTable(nameDealer.lumivalidationTableName()): 00232 lumivalidation=coral.TableDescription() 00233 lumivalidation.setName( nameDealer.lumivalidationTableName() ) 00234 lumivalidation.insertColumn( 'RUNNUM','unsigned int' ) 00235 lumivalidation.insertColumn( 'CMSLSNUM','unsigned int' ) 00236 lumivalidation.insertColumn( 'FLAG','string' ) 00237 lumivalidation.insertColumn( 'COMMENT','string' ) 00238 lumivalidation.setPrimaryKey(('RUNNUM','CMSLSNUM')) 00239 lumivalidation.setNotNullConstraint('FLAG',True) 00240 db.createTable(lumivalidation,withIdTable=False) 00241 created.append(nameDealer.lumivalidationTableName()) 00242 00243 if not schema.existsTable(nameDealer.cmsrunsummaryTableName()): 00244 cmsrunsummary=coral.TableDescription() 00245 cmsrunsummary.setName( nameDealer.cmsrunsummaryTableName() ) 00246 cmsrunsummary.insertColumn('RUNNUM','unsigned int') 00247 cmsrunsummary.insertColumn('HLTKEY','string') 00248 cmsrunsummary.insertColumn('FILLNUM','unsigned int') 00249 cmsrunsummary.insertColumn('SEQUENCE','string') 00250 cmsrunsummary.insertColumn('STARTTIME','time stamp',6) 00251 cmsrunsummary.insertColumn('STOPTIME','time stamp',6) 00252 cmsrunsummary.setPrimaryKey('RUNNUM') 00253 cmsrunsummary.setNotNullConstraint('HLTKEY',True) 00254 cmsrunsummary.setNotNullConstraint('FILLNUM',True) 00255 cmsrunsummary.setNotNullConstraint('SEQUENCE',True) 00256 cmsrunsummary.createIndex('cmsrunsummary_fillnum',('FILLNUM')) 00257 cmsrunsummary.createIndex('cmsrunsummary_startime',('STARTTIME')) 00258 db.createTable(cmsrunsummary,withIdTable=False) 00259 created.append(nameDealer.cmsrunsummaryTableName()) 00260 00261 if not schema.existsTable(nameDealer.lumisummaryTableName()): 00262 summary=coral.TableDescription() 00263 summary.setName( nameDealer.lumisummaryTableName() ) 00264 summary.insertColumn('LUMISUMMARY_ID','unsigned long long') 00265 summary.insertColumn('RUNNUM','unsigned int') 00266 summary.insertColumn('CMSLSNUM','unsigned int') 00267 summary.insertColumn('LUMILSNUM','unsigned int') 00268 summary.insertColumn('LUMIVERSION','string') 00269 summary.insertColumn('DTNORM','float') 00270 summary.insertColumn('LHCNORM','float') 00271 summary.insertColumn('CMSALIVE','short') 00272 summary.insertColumn('INSTLUMI','float') 00273 summary.insertColumn('INSTLUMIERROR','float') 00274 summary.insertColumn('INSTLUMIQUALITY','short') 00275 summary.insertColumn('BEAMSTATUS','string') 00276 summary.insertColumn('BEAMENERGY','float') 00277 summary.insertColumn('NUMORBIT','unsigned int') 00278 summary.insertColumn('STARTORBIT','unsigned int') 00279 summary.insertColumn('LUMISECTIONQUALITY','short') 00280 summary.insertColumn('CMSBXINDEXBLOB','blob') 00281 summary.insertColumn('BEAMINTENSITYBLOB_1','blob') 00282 summary.insertColumn('BEAMINTENSITYBLOB_2','blob') 00283 summary.setPrimaryKey('LUMISUMMARY_ID') 00284 summary.setNotNullConstraint('RUNNUM',True) 00285 summary.setNotNullConstraint('CMSLSNUM',True) 00286 summary.setNotNullConstraint('LUMILSNUM',True) 00287 summary.setNotNullConstraint('CMSALIVE',True) 00288 summary.setNotNullConstraint('LUMIVERSION',True) 00289 summary.setNotNullConstraint('DTNORM',True) 00290 summary.setNotNullConstraint('LHCNORM',True) 00291 summary.setNotNullConstraint('INSTLUMI',True) 00292 summary.setNotNullConstraint('INSTLUMIERROR',True) 00293 summary.setNotNullConstraint('INSTLUMIQUALITY',True) 00294 summary.setNotNullConstraint('STARTORBIT',True) 00295 summary.setNotNullConstraint('NUMORBIT',True) 00296 summary.setNotNullConstraint('LUMISECTIONQUALITY',True) 00297 summary.setNotNullConstraint('BEAMENERGY',True) 00298 summary.setNotNullConstraint('BEAMSTATUS',True) 00299 summary.setUniqueConstraint(('RUNNUM','LUMIVERSION','LUMILSNUM')) 00300 summary.createIndex('lumisummary_runnum',('RUNNUM')) 00301 db.createTable(summary,withIdTable=True) 00302 created.append(nameDealer.lumisummaryTableName()) 00303 00304 if not schema.existsTable(nameDealer.lumidetailTableName()): 00305 detail=coral.TableDescription() 00306 detail.setName( nameDealer.lumidetailTableName() ) 00307 detail.insertColumn('LUMIDETAIL_ID','unsigned long long') 00308 detail.insertColumn('LUMISUMMARY_ID','unsigned long long') 00309 detail.insertColumn('BXLUMIVALUE','blob') 00310 detail.insertColumn('BXLUMIERROR','blob') 00311 detail.insertColumn('BXLUMIQUALITY','blob') 00312 detail.insertColumn('ALGONAME','string') 00313 detail.setPrimaryKey('LUMIDETAIL_ID') 00314 detail.createForeignKey('DETAILSOURCE','LUMISUMMARY_ID',nameDealer.lumisummaryTableName(),'LUMISUMMARY_ID') 00315 detail.setNotNullConstraint('BXLUMIVALUE',True) 00316 detail.setNotNullConstraint('BXLUMIERROR',True) 00317 detail.setNotNullConstraint('BXLUMIQUALITY',True) 00318 detail.setNotNullConstraint('ALGONAME',True) 00319 detail.setUniqueConstraint(('LUMISUMMARY_ID','ALGONAME')) 00320 db.createTable(detail,withIdTable=True) 00321 created.append(nameDealer.lumidetailTableName()) 00322 00323 if not schema.existsTable(nameDealer.trgTableName()): 00324 trg=coral.TableDescription() 00325 trg.setName( nameDealer.trgTableName() ) 00326 trg.insertColumn('TRG_ID','unsigned long long') 00327 trg.insertColumn('RUNNUM','unsigned int') 00328 trg.insertColumn('CMSLSNUM','unsigned int') 00329 trg.insertColumn('BITNUM','unsigned int') 00330 trg.insertColumn('BITNAME','string') 00331 trg.insertColumn('TRGCOUNT','unsigned int') 00332 trg.insertColumn('DEADTIME','unsigned long long') 00333 trg.insertColumn('PRESCALE','unsigned int') 00334 trg.setNotNullConstraint('RUNNUM',True) 00335 trg.setNotNullConstraint('CMSLSNUM',True) 00336 trg.setNotNullConstraint('BITNUM',True) 00337 trg.setNotNullConstraint('BITNAME',True) 00338 trg.setNotNullConstraint('TRGCOUNT',True) 00339 trg.setNotNullConstraint('DEADTIME',True) 00340 trg.setNotNullConstraint('PRESCALE',True) 00341 trg.setPrimaryKey('TRG_ID') 00342 trg.createIndex('trg_runnum',('RUNNUM')) 00343 db.createTable(trg,withIdTable=True) 00344 created.append( nameDealer.trgTableName() ) 00345 00346 if not schema.existsTable( nameDealer.hltTableName() ): 00347 hlt=coral.TableDescription() 00348 hlt.setName( nameDealer.hltTableName() ) 00349 hlt.insertColumn( 'HLT_ID','unsigned long long') 00350 hlt.insertColumn( 'RUNNUM','unsigned int') 00351 hlt.insertColumn( 'CMSLSNUM','unsigned int') 00352 hlt.insertColumn( 'PATHNAME','string') 00353 hlt.insertColumn( 'INPUTCOUNT','unsigned int') 00354 hlt.insertColumn( 'ACCEPTCOUNT','unsigned int') 00355 hlt.insertColumn( 'PRESCALE','unsigned int') 00356 hlt.setPrimaryKey( 'HLT_ID' ) 00357 hlt.setNotNullConstraint('RUNNUM',True) 00358 hlt.setNotNullConstraint('CMSLSNUM',True) 00359 hlt.setNotNullConstraint('PATHNAME',True) 00360 hlt.setNotNullConstraint('INPUTCOUNT',True) 00361 hlt.setNotNullConstraint('ACCEPTCOUNT',True) 00362 hlt.setNotNullConstraint('PRESCALE',True) 00363 hlt.createIndex('hlt_runnum',('RUNNUM')) 00364 db.createTable(hlt,withIdTable=True) 00365 created.append( nameDealer.hltTableName() ) 00366 00367 if not schema.existsTable( nameDealer.trghltMapTableName() ): 00368 trghlt=coral.TableDescription() 00369 trghlt.setName( nameDealer.trghltMapTableName() ) 00370 trghlt.insertColumn( 'HLTKEY','string' ) 00371 trghlt.insertColumn( 'HLTPATHNAME','string' ) 00372 trghlt.insertColumn( 'L1SEED','string' ) 00373 trghlt.setNotNullConstraint('HLTKEY',True) 00374 trghlt.setNotNullConstraint('HLTPATHNAME',True) 00375 trghlt.setNotNullConstraint('L1SEED',True) 00376 db.createTable(trghlt,withIdTable=False) 00377 created.append( nameDealer.trghltMapTableName() ) 00378 return created 00379 except: 00380 raise 00381 00382 #======================================================= 00383 # 00384 # MODIFY 00385 # #=======================================================
def lumidbDDL::createTables | ( | schema | ) |
create new tables if not exist revisions,revisions_id,luminorms,luminorms_entries,luminorms_entries_id,
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, 00013 ''' 00014 try: 00015 created=[] 00016 db=dbUtil.dbUtil(schema) 00017 if not schema.existsTable(nameDealer.revisionTableName()): 00018 print 'creating revisions table' 00019 revisionsTab=coral.TableDescription() 00020 revisionsTab.setName( nameDealer.revisionTableName() ) 00021 revisionsTab.insertColumn( 'REVISION_ID','unsigned long long') 00022 revisionsTab.insertColumn( 'BRANCH_ID','unsigned long long') 00023 revisionsTab.insertColumn( 'NAME', 'string') 00024 revisionsTab.insertColumn( 'BRANCH_NAME', 'string') 00025 revisionsTab.insertColumn( 'COMMENT', 'string') 00026 revisionsTab.insertColumn( 'CTIME', 'time stamp',6) 00027 revisionsTab.setPrimaryKey( 'REVISION_ID' ) 00028 revisionsTab.setUniqueConstraint(('NAME')) 00029 db.createTable(revisionsTab,withIdTable=True) 00030 created.append(nameDealer.revisionTableName()) 00031 00032 if not schema.existsTable(nameDealer.luminormTableName()): 00033 print 'creating luminorms table' 00034 luminormsTab=coral.TableDescription() 00035 luminormsTab.setName( nameDealer.luminormTableName() ) 00036 luminormsTab.insertColumn( 'DATA_ID','unsigned long long') 00037 luminormsTab.insertColumn( 'ENTRY_ID','unsigned long long') 00038 luminormsTab.insertColumn( 'ENTRY_NAME','string') 00039 luminormsTab.insertColumn( 'AMODETAG', 'string') 00040 luminormsTab.insertColumn( 'NORM_1', 'float') 00041 luminormsTab.insertColumn( 'EGEV_1', 'unsigned int') 00042 luminormsTab.insertColumn( 'NORM_2', 'float') 00043 luminormsTab.insertColumn( 'EGEV_2', 'unsigned int') 00044 luminormsTab.setPrimaryKey( 'DATA_ID' ) 00045 db.createTable(luminormsTab,withIdTable=True,withEntryTables=True,withRevMapTable=True) 00046 created.append(nameDealer.luminormTableName()) 00047 00048 if not schema.existsTable(nameDealer.lumidataTableName()): 00049 print 'creating lumidata table' 00050 lumidataTab=coral.TableDescription() 00051 lumidataTab.setName( nameDealer.lumidataTableName() ) 00052 lumidataTab.insertColumn( 'DATA_ID','unsigned long long') 00053 lumidataTab.insertColumn( 'ENTRY_ID','unsigned long long') 00054 lumidataTab.insertColumn( 'ENTRY_NAME','string') 00055 lumidataTab.insertColumn( 'SOURCE', 'string') 00056 lumidataTab.insertColumn( 'RUNNUM', 'unsigned int') 00057 lumidataTab.insertColumn( 'NOMINALEGEV', 'float') 00058 lumidataTab.setPrimaryKey( 'DATA_ID' ) 00059 db.createTable(lumidataTab,withIdTable=True,withEntryTables=True,withRevMapTable=True) 00060 created.append(nameDealer.lumidataTableName()) 00061 00062 if not schema.existsTable(nameDealer.lumisummaryv2TableName() ): 00063 print 'creating lumisummaryv2 table' 00064 summary=coral.TableDescription() 00065 summary.setName( nameDealer.lumisummaryv2TableName() ) 00066 summary.insertColumn('DATA_ID','unsigned long long') 00067 summary.insertColumn('RUNNUM','unsigned int') 00068 summary.insertColumn('LUMILSNUM','unsigned int') 00069 summary.insertColumn('CMSLSNUM','unsigned int') 00070 summary.insertColumn('INSTLUMI','float') 00071 summary.insertColumn('INSTLUMIERROR','float') 00072 summary.insertColumn('INSTLUMIQUALITY','short') 00073 summary.insertColumn('BEAMSTATUS','string') 00074 summary.insertColumn('BEAMENERGY','float') 00075 summary.insertColumn('NUMORBIT','unsigned int') 00076 summary.insertColumn('STARTORBIT','unsigned int') 00077 summary.insertColumn('CMSBXINDEXBLOB','blob') 00078 summary.insertColumn('BEAMINTENSITYBLOB_1','blob') 00079 summary.insertColumn('BEAMINTENSITYBLOB_2','blob') 00080 summary.insertColumn('BXLUMIVALUE_OCC1','blob') 00081 summary.insertColumn('BXLUMIVALUE_OCC2','blob') 00082 summary.insertColumn('BXLUMIVALUE_ET','blob') 00083 summary.insertColumn('BXLUMIERROR_OCC1','blob') 00084 summary.insertColumn('BXLUMIERROR_OCC2','blob') 00085 summary.insertColumn('BXLUMIERROR_ET','blob') 00086 summary.insertColumn('BXLUMIQUALITY_OCC1','blob') 00087 summary.insertColumn('BXLUMIQUALITY_OCC2','blob') 00088 summary.insertColumn('BXLUMIQUALITY_ET','blob') 00089 summary.setPrimaryKey(('DATA_ID','LUMILSNUM')) 00090 db.createTable(summary,withIdTable=False) 00091 created.append(nameDealer.lumisummaryv2TableName()) 00092 00093 # 00094 # This table exists in the old schema 00095 # 00096 if not schema.existsTable(nameDealer.cmsrunsummaryTableName()): 00097 print 'creating cmsrunsummary table' 00098 cmsrunsummary=coral.TableDescription() 00099 cmsrunsummary.setName( nameDealer.cmsrunsummaryTableName() ) 00100 cmsrunsummary.insertColumn('RUNNUM','unsigned int') 00101 cmsrunsummary.insertColumn('HLTKEY','string') 00102 cmsrunsummary.insertColumn('L1KEY','string') 00103 cmsrunsummary.insertColumn('FILLNUM','unsigned int') 00104 cmsrunsummary.insertColumn('SEQUENCE','string') 00105 cmsrunsummary.insertColumn('STARTTIME','time stamp',6) 00106 cmsrunsummary.insertColumn('STOPTIME','time stamp',6) 00107 cmsrunsummary.insertColumn('EGEV','unsigned int') 00108 cmsrunsummary.insertColumn('AMODETAG','string') 00109 cmsrunsummary.setPrimaryKey('RUNNUM') 00110 db.createTable(cmsrunsummary,withIdTable=False) 00111 created.append(nameDealer.cmsrunsummaryTableName()) 00112 # 00113 # This table exists in the old schema 00114 # 00115 if not schema.existsTable(nameDealer.trghltMapTableName()): 00116 print 'creating trghltmap table' 00117 trghlt=coral.TableDescription() 00118 trghlt.setName( nameDealer.trghltMapTableName() ) 00119 trghlt.insertColumn( 'HLTKEY','string' ) 00120 trghlt.insertColumn( 'HLTPATHNAME','string' ) 00121 trghlt.insertColumn( 'L1SEED','string' ) 00122 trghlt.setNotNullConstraint('HLTKEY',True) 00123 trghlt.setNotNullConstraint('HLTPATHNAME',True) 00124 trghlt.setNotNullConstraint('L1SEED',True) 00125 db.createTable(trghlt,withIdTable=False) 00126 created.append(nameDealer.trghltMapTableName()) 00127 if not schema.existsTable(nameDealer.trgdataTableName()): 00128 print 'creating trgdata table' 00129 trgdataTab=coral.TableDescription() 00130 trgdataTab.setName( nameDealer.trgdataTableName() ) 00131 trgdataTab.insertColumn( 'DATA_ID','unsigned long long') 00132 trgdataTab.insertColumn( 'ENTRY_ID','unsigned long long') 00133 trgdataTab.insertColumn( 'ENTRY_NAME','string') 00134 trgdataTab.insertColumn( 'SOURCE', 'string') 00135 trgdataTab.insertColumn( 'RUNNUM', 'unsigned int') 00136 trgdataTab.insertColumn( 'BITZERONAME', 'string') 00137 trgdataTab.insertColumn( 'BITNAMECLOB', 'string',6000) 00138 trgdataTab.setPrimaryKey( 'DATA_ID' ) 00139 db.createTable(trgdataTab,withIdTable=True,withEntryTables=True,withRevMapTable=True) 00140 created.append(nameDealer.trgdataTableName()) 00141 if not schema.existsTable(nameDealer.lstrgTableName()): 00142 print 'creating lstrg table' 00143 lstrgTab=coral.TableDescription() 00144 lstrgTab.setName( nameDealer.lstrgTableName() ) 00145 lstrgTab.insertColumn( 'DATA_ID','unsigned long long') 00146 lstrgTab.insertColumn( 'RUNNUM', 'unsigned int') 00147 lstrgTab.insertColumn( 'CMSLSNUM', 'unsigned int') 00148 lstrgTab.insertColumn( 'DEADTIMECOUNT', 'unsigned long long') 00149 lstrgTab.insertColumn( 'BITZEROCOUNT', 'unsigned int') 00150 lstrgTab.insertColumn( 'BITZEROPRESCALE', 'unsigned int') 00151 lstrgTab.insertColumn( 'DEADFRAC', 'float') 00152 lstrgTab.insertColumn( 'PRESCALEBLOB', 'blob') 00153 lstrgTab.insertColumn( 'TRGCOUNTBLOB', 'blob') 00154 lstrgTab.setPrimaryKey( ('DATA_ID','CMSLSNUM') ) 00155 db.createTable(lstrgTab,withIdTable=False) 00156 created.append( nameDealer.lstrgTableName() ) 00157 00158 if not schema.existsTable(nameDealer.hltdataTableName()): 00159 print 'creating hltdata table' 00160 hltdataTab=coral.TableDescription() 00161 hltdataTab.setName( nameDealer.hltdataTableName() ) 00162 hltdataTab.insertColumn( 'DATA_ID','unsigned long long') 00163 hltdataTab.insertColumn( 'ENTRY_ID','unsigned long long') 00164 hltdataTab.insertColumn( 'ENTRY_NAME','string') 00165 hltdataTab.insertColumn( 'RUNNUM', 'unsigned int') 00166 hltdataTab.insertColumn( 'SOURCE', 'string') 00167 hltdataTab.insertColumn( 'NPATH', 'unsigned int') 00168 hltdataTab.insertColumn( 'PATHNAMECLOB', 'string',6000) 00169 hltdataTab.setPrimaryKey( 'DATA_ID' ) 00170 db.createTable(hltdataTab,withIdTable=True,withEntryTables=True,withRevMapTable=True) 00171 created.append(nameDealer.hltTableName()) 00172 00173 if not schema.existsTable(nameDealer.lshltTableName()): 00174 print 'creating lshlt table' 00175 lshltTab=coral.TableDescription() 00176 lshltTab.setName( nameDealer.lshltTableName() ) 00177 lshltTab.insertColumn( 'DATA_ID','unsigned long long') 00178 lshltTab.insertColumn( 'RUNNUM', 'unsigned int') 00179 lshltTab.insertColumn( 'CMSLSNUM', 'unsigned int') 00180 lshltTab.insertColumn( 'PRESCALEBLOB', 'blob') 00181 lshltTab.insertColumn( 'HLTCOUNTBLOB', 'blob') 00182 lshltTab.insertColumn( 'HLTACCEPTBLOB', 'blob') 00183 db.createTable(lshltTab,withIdTable=False) 00184 lshltTab.setPrimaryKey( ('DATA_ID','CMSLSNUM') ) 00185 created.append(nameDealer.lshltTableName()) 00186 00187 00188 if not schema.existsTable(nameDealer.lumivalidationTableName()): 00189 print 'creating lumivalidation table' 00190 lumivalidation=coral.TableDescription() 00191 lumivalidation.setName( nameDealer.lumivalidationTableName() ) 00192 lumivalidation.insertColumn( 'RUNNUM','unsigned int' ) 00193 lumivalidation.insertColumn( 'CMSLSNUM','unsigned int' ) 00194 lumivalidation.insertColumn( 'FLAG','string' ) 00195 lumivalidation.insertColumn( 'COMMENT','string' ) 00196 lumivalidation.setPrimaryKey( ('RUNNUM','CMSLSNUM') ) 00197 lumivalidation.setNotNullConstraint('FLAG',True) 00198 db.createTable(lumivalidation,withIdTable=False) 00199 created.append(nameDealer.lumivalidationTableName()) 00200 return created 00201 except : 00202 raise 00203 00204 00205 #======================================================= 00206 # 00207 # DROP 00208 # #=======================================================
def lumidbDDL::createUniqueConstraints | ( | schema | ) |
Definition at line 456 of file lumidbDDL.py.
def lumidbDDL::describe | ( | schema | ) |
def lumidbDDL::describeIndices | ( | schema | ) |
def lumidbDDL::dropFKConstrains | ( | schema | ) |
def lumidbDDL::dropIndices | ( | schema | ) |
def lumidbDDL::dropNULLConstraints | ( | schema | ) |
def lumidbDDL::dropTables | ( | schema, | |
tablelist | |||
) |
Definition at line 209 of file lumidbDDL.py.
00210 : 00211 try: 00212 db=dbUtil.dbUtil(schema) 00213 for tablename in tablelist: 00214 if tablename in [nameDealer.luminormTableName(),nameDealer.lumidataTableName(),nameDealer.trgdataTableName(),nameDealer.hltdataTableName()]: 00215 db.dropTable( nameDealer.idTableName(tablename) ) 00216 db.dropTable( nameDealer.entryTableName(tablename) ) 00217 db.dropTable( nameDealer.revmapTableName(tablename) ) 00218 if tablename in [nameDealer.trgTableName(),nameDealer.lumisummaryTableName(),nameDealer.lumisummaryv2TableName(),nameDealer.lumidetailTableName(),nameDealer.hltTableName()]: 00219 db.dropTable( nameDealer.idTableName(tablename) ) 00220 db.dropTable( tablename ) 00221 except : 00222 raise
def lumidbDDL::dropUNIQUEConstraints | ( | schema | ) |
def lumidbDDL::newToOld | ( | schema | ) |
Definition at line 400 of file lumidbDDL.py.
00401 : 00402 try: 00403 dropTables(schema,['REVISIONS','LUMINORMS','LUMIDATA','LUMISUMMARYV2','TRGDATA','LSTRG','HLTDATA','LSHLT']) 00404 tableHandle=schema.tableHandle(nameDealer.cmsrunsummaryTableName()) 00405 ncol=tableHandle.description().numberOfColumns() 00406 todrop=[] 00407 for i in range(ncol): 00408 colname=tableHandle.description().columnDescription(i).name() 00409 if colname in ['L1KEY','EGEV','AMODETAG']: 00410 todrop.append(colname) 00411 for colname in todrop: 00412 tableHandle.schemaEditor().dropColumn(colname) 00413 except : 00414 raise 00415 00416 #======================================================= 00417 # 00418 # TODO 00419 # 00420 #=======================================================
def lumidbDDL::oldToNew | ( | schema | ) |
modify old tables:cmsrunsummary alter table cmsrunsummary add column(l1key string,egev unsigned int,amodetag string)
Definition at line 386 of file lumidbDDL.py.
00387 : 00388 ''' 00389 modify old tables:cmsrunsummary 00390 alter table cmsrunsummary add column(l1key string,egev unsigned int,amodetag string) 00391 ''' 00392 try: 00393 tableHandle=schema.tableHandle(nameDealer.cmsrunsummaryTableName()) 00394 tableHandle.schemaEditor().insertColumn('L1KEY','string') 00395 tableHandle.schemaEditor().insertColumn('EGEV','unsigned int') 00396 tableHandle.schemaEditor().insertColumn('AMODETAG','string') 00397 createTables(schema) 00398 except: 00399 raise
string lumidbDDL::authpath = '/afs/cern.ch/user/x/xiezhen' |
Definition at line 477 of file lumidbDDL.py.
string lumidbDDL::myconstr = 'oracle://devdb10/cms_xiezhen_dev' |
Definition at line 476 of file lumidbDDL.py.
tuple lumidbDDL::schema = session.nominalSchema() |
Definition at line 481 of file lumidbDDL.py.
tuple lumidbDDL::session = svc.openSession(isReadOnly=False,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')]) |
Definition at line 480 of file lumidbDDL.py.
tuple lumidbDDL::svc = sessionManager.sessionManager(myconstr,authpath=authpath,debugON=False) |
Definition at line 479 of file lumidbDDL.py.
tuple lumidbDDL::tables = createTables(schema) |
Definition at line 483 of file lumidbDDL.py.