calculerToutDump.py 767 Bytes
Newer Older
JonathanMM's avatar
JonathanMM committed
1
from dumpLib import creerDumpData, creerDumpConso
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
import pymysql, datetime
from config import getMysqlConnection

#On commence par avoir la date min et max
mysql = getMysqlConnection()
requete = mysql.cursor()
requete.execute("SELECT MIN(date), MAX(date) FROM `statusConso`")
bornesDate = requete.fetchone()
dateMin = bornesDate[0].replace(microsecond = 0, second = 0, minute = 0, hour = 0)
dateMax = bornesDate[1].replace(microsecond = 0, second = 0, minute = 0, hour = 0)
date = dateMin
print("******* Bornes *******")
print("Début = "+str(dateMin))
print("Fin = "+str(dateMax))
print("******* Bornes *******")
while date < dateMax:
    print("Calcul de : " + str(date))
    creerDumpData(date)
20
    creerDumpConso(date)
21
    date = date + datetime.timedelta(days=1)