diff --git a/statistiques/getStats.py b/statistiques/getStats.py index 8921c7e..bc8d271 100755 --- a/statistiques/getStats.py +++ b/statistiques/getStats.py @@ -29,6 +29,7 @@ class SQLite: value_field text ) ''') + self.conn.commit() self.__closeDb() def __openDb(self): @@ -42,11 +43,14 @@ class SQLite: def dbQuery(self,query='SELECT'): self.__openDb() self.cursor.execute(f"""SELECT * FROM jististats""") + rows = self.cursor.fetchall() self.__closeDb() + return rows def dbInsert(self,ts,k,v): self.__openDb() self.cursor.execute(f"""INSERT INTO jististats (timestamp,key_field,value_field) VALUES ('{ts}','{k}','{v}')""") + self.conn.commit() self.__closeDb() @@ -60,6 +64,7 @@ def runMain(): for (k,v) in response.json().items(): db.dbInsert(timestamp,k,v) fh.write(f"{k};{v};{timestamp}\n") + db.dbQuery() # Principal if __name__ == '__main__':