2 from __future__
import print_function
6 from RecoLuminosity.LumiDB
import argparse,dbUtil,nameDealer,lumidbDDL,dataDML,revisionDML
9 print(
'creating lumidb2 schema...')
10 dbsession.transaction().
start(
False)
11 schema=dbsession.nominalSchema()
13 dbsession.transaction().commit()
16 print(
'droping lumi db2 schema...')
17 dbsession.transaction().
start(
False)
18 schema=dbsession.nominalSchema()
20 dbsession.transaction().commit()
23 print(
'lumi db schema dump...')
24 dbsession.transaction().
start(
True)
25 schema=dbsession.nominalSchema()
28 dbsession.transaction().commit()
37 print(
'creating branch ',branchname)
38 dbsession.transaction().
start(
False)
40 dbsession.transaction().commit()
41 print(
'branchid ',branchid,
' parentname ',parentname,
' parentid ',parentid)
44 parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description=
"Lumi DB schema operations.")
46 parser.add_argument(
'-c',dest=
'connect',action=
'store',required=
True,help=
'connect string to lumiDB')
47 parser.add_argument(
'-P',dest=
'authpath',action=
'store',help=
'path to authentication file')
48 parser.add_argument(
'action',choices=[
'create',
'createbranch',
'drop',
'describe',
'addindex',
'dropindex'],help=
'action on the schema')
49 parser.add_argument(
'--verbose',dest=
'verbose',action=
'store_true',help=
'verbose')
50 parser.add_argument(
'--debug',dest=
'debug',action=
'store_true',help=
'debug mode')
52 args=parser.parse_args()
53 connectstring=args.connect
55 msg=coral.MessageStream(
'')
56 msg.setMsgVerbosity(coral.message_Level_Debug)
57 svc = coral.ConnectionService()
58 if args.authpath
and len(args.authpath)!=0:
59 os.environ[
'CORAL_AUTH_PATH']=args.authpath
60 session=svc.connect(connectstring,accessMode=coral.access_Update)
61 if args.action ==
'create':
63 if args.action ==
'createbranch':
65 createBranch(session,
'NORM',
'TRUNK',
'hold normalization factor')
67 if args.action ==
'drop':
69 if args.action ==
'describe':
71 if args.action ==
'addindex':
73 if args.action ==
'dropindex':
77 if __name__==
'__main__':
def dropTables(schema, tablelist)
def createIndex(dbsession)
S & print(S &os, JobReport::InputFile const &f)
def createLumi(dbsession)
def createBranch(dbsession, branchname, parentname, comment)
def describeLumi(dbsession)
def createBranch(schema, name, parentname, comment='')