Fill run catalog with nfiles entries
Based on sqlfill.C by Sergey Linev
from ROOT import TSQLServer, TSQLResult, TStopwatch, gRandom
nfiles = 1000
ins = "INSERT INTO runcatalog VALUES ('%s', %d," \
" %d, %d, %d, %10.2f, '%s', '%s', '1997-01-15 20:16:28'," \
" '1999-01-15 20:16:28', '%s', '%s')"
tag = evt = 0
res = db.Query("DELETE FROM runcatalog")
timer.Start()
for i in range(nfiles):
dataset = "testrun_%d" % i
rawfile = "/v1/data/lead/test/run_%d.root" % i
tag =
int(gRandom.Rndm() * 10.)
sql = ins % (dataset, i, evt, evt + 10000, tag, 25.5, "test", "lead",
rawfile, "test run dummy data")
evt += 10000
res = db.Query(sql)
timer.Stop()
rtime = timer.RealTime()
ctime = timer.CpuTime()
print("")
print("%d files in run catalog" % nfiles)
print("RealTime=%f seconds, CpuTime=%f seconds" % (rtime, ctime))
static TSQLServer * Connect(const char *db, const char *uid, const char *pw)
The db should be of the form: <dbms>://<host>[:<port>][/<database>], e.g.: mysql://pcroot....
- Author
- Juan Fernando Jaramillo Botero
Definition in file sqlfilldb.py.