def dump_to_db(db, data_type, date, data):
	insertString = "insert into %s values (?, ?)" % data_type
	sum = 0
	for row in data:
		db.execute(insertString, (mktime(row[0].timetuple()), row[1]))
		sum += row[1]
	db.execute("insert into %s_daily values (?, ?)" % data_type, (mktime(date.timetuple()), sum))
	db.commit()
dataset/ETHPy150Open wadey/python-fitbit/examples/dump2sqlite.py/dump_to_db/original