Skip to content

Commit

Permalink
Leave the cursor open - slightly more efficient, no reason not to.
Browse files Browse the repository at this point in the history
  • Loading branch information
painter1 committed May 14, 2021
1 parent 670af73 commit 2eab129
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions report_cumulative_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ def finish():
stop_date = datetime.date(2021, 5, 10)
#testing stop_date = datetime.date(2018, 7, 2)
delta = datetime.timedelta(days=1)
curs = conn.cursor()
while end_date <= stop_date:
cmd = "SELECT SUM(size) FROM dataset WHERE last_done_transfer_date<'%s' "\
% str(end_date)
try:
curs = conn.cursor()
curs.execute( cmd )
results = curs.fetchall()
except Exception as e:
logging.debug("report_cumulative_data saw an exception %s" %e)
raise e
finally:
curs.close()
raise e
assert( len(results)==1 )
size = results[0][0]
rcd.write( str(end_date)[:10]+" 00:00:00,"+str(size)+".0\n" )
end_date += delta
curs.close()

finish()

0 comments on commit 2eab129

Please sign in to comment.