Commit b77b8c10 authored by JonathanMM's avatar JonathanMM

Optimisation de la BDD après nettoyage

parent 29c2d5c9
import datetime
from nettoyageLib import nettoyerInstantanne, nettoyerConso
from nettoyageLib import nettoyerInstantanne, nettoyerConso, optimiserBDD
date = datetime.datetime.today() - datetime.timedelta(days=2)
dateLimite = date.replace(microsecond = 0, second = 0, minute=0, hour=0)
......@@ -7,4 +7,5 @@ nettoyerInstantanne(dateLimite)
nettoyerConso(dateLimite, "duree = 5 OR duree = 15")
dateHuitJours = datetime.datetime.today() - datetime.timedelta(days=8)
dateLimiteHuitJours = dateHuitJours.replace(microsecond = 0, second = 0, minute=0, hour=0)
nettoyerConso(dateLimiteHuitJours, "duree = 60")
\ No newline at end of file
nettoyerConso(dateLimiteHuitJours, "duree = 60")
optimiserBDD()
\ No newline at end of file
......@@ -17,4 +17,9 @@ def nettoyerConso(date, filtre):
requete = mysql.cursor()
requete.execute('DELETE FROM resumeStatus WHERE date < "'+dateStr+'" AND ('+filtre+')')
requete = mysql.cursor()
requete.execute('DELETE FROM resumeConso WHERE date < "'+dateStr+'" AND ('+filtre+')')
\ No newline at end of file
requete.execute('DELETE FROM resumeConso WHERE date < "'+dateStr+'" AND ('+filtre+')')
def optimiserBDD():
mysql = getMysqlConnection()
requete = mysql.cursor()
requete.execute('OPTIMIZE TABLE resumeConso, resumeStatus, status, statusConso')
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment