Skip to content

Instantly share code, notes, and snippets.

@minorsecond
Created April 28, 2015 22:57
Show Gist options
  • Save minorsecond/e5de107f909becbd07b5 to your computer and use it in GitHub Desktop.
Save minorsecond/e5de107f909becbd07b5 to your computer and use it in GitHub Desktop.
Sanity Check: Get sum of time worked (t_worked) of each row in sqlite database.
t_worked = session.query(Clocktime).filter(Clocktime.p_uuid == p_uuid).order_by(Clocktime.id.desc()).all()
for i in tworked:
_sum_time += i.t_worked
eg. I want sum of time for p_uuid==1, _sum_time should equal '8'.
p_uuid t_worked
===================
1 1
1 2
1 5
2 2
2 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment