def db_hits(): """Will show how many hits by querying the db.""" #Adds the current hit to the database current_hit = model.Hit(hit_date=datetime.now()) model.sqla_session.add(current_hit) model.sqla_session.commit() #Determines how many hits the database has had. hits = model.sqla_session.query(model.Hit).count() return render_template("mysqlhit.html", hits=hits)
PSA.QEventTot = tbjcPSAReg.QEventTot for j in range(TB): setattr(PSA, 'mesh'+str(j), tbjcPSAReg.mesh[j]) session.add(PSA) session.flush() session.commit() # In[ ]: for i in xrange(tb2.GetEntries()): if i %100 ==0: print i tb2.GetEntry(i) Hit = model.Hit() #Hit.ID = i Hit.EventID = tbjcHitReg.EventNum Hit.PadNum = tbjcHitReg.PadNum Hit.x = tbjcHitReg.x Hit.y = tbjcHitReg.y Hit.z = tbjcHitReg.z Hit.charge = tbjcHitReg.charge session.add(Hit) session.flush() session.commit() # In[ ]: