5 from RecoLuminosity.LumiDB
import argparse,dbUtil,nameDealer,lumidbDDL,dataDML,revisionDML
8 print 'creating lumidb2 schema...' 9 dbsession.transaction().
start(
False)
10 schema=dbsession.nominalSchema()
12 dbsession.transaction().commit()
15 print 'droping lumi db2 schema...' 16 dbsession.transaction().
start(
False)
17 schema=dbsession.nominalSchema()
19 dbsession.transaction().commit()
22 print 'lumi db schema dump...' 23 dbsession.transaction().
start(
True)
24 schema=dbsession.nominalSchema()
27 dbsession.transaction().commit()
36 print 'creating branch ',branchname
37 dbsession.transaction().
start(
False)
39 dbsession.transaction().commit()
40 print 'branchid ',branchid,
' parentname ',parentname,
' parentid ',parentid
43 parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description=
"Lumi DB schema operations.")
45 parser.add_argument(
'-c',dest=
'connect',action=
'store',required=
True,help=
'connect string to lumiDB')
46 parser.add_argument(
'-P',dest=
'authpath',action=
'store',help=
'path to authentication file')
47 parser.add_argument(
'action',choices=[
'create',
'createbranch',
'drop',
'describe',
'addindex',
'dropindex'],help=
'action on the schema')
48 parser.add_argument(
'--verbose',dest=
'verbose',action=
'store_true',help=
'verbose')
49 parser.add_argument(
'--debug',dest=
'debug',action=
'store_true',help=
'debug mode')
51 args=parser.parse_args()
52 connectstring=args.connect
54 msg=coral.MessageStream(
'')
55 msg.setMsgVerbosity(coral.message_Level_Debug)
56 svc = coral.ConnectionService()
57 if args.authpath
and len(args.authpath)!=0:
58 os.environ[
'CORAL_AUTH_PATH']=args.authpath
59 session=svc.connect(connectstring,accessMode=coral.access_Update)
60 if args.action ==
'create':
62 if args.action ==
'createbranch':
64 createBranch(session,
'NORM',
'TRUNK',
'hold normalization factor')
66 if args.action ==
'drop':
68 if args.action ==
'describe':
70 if args.action ==
'addindex':
72 if args.action ==
'dropindex':
76 if __name__==
'__main__':
def dropTables(schema, tablelist)
def createIndex(dbsession)
def createLumi(dbsession)
def createBranch(dbsession, branchname, parentname, comment)
def describeLumi(dbsession)
def createBranch(schema, name, parentname, comment='')