From 5fbf657b1b2892cfdb9304befe5b920bf1277c73 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 18 Dec 2022 23:16:39 +0100 Subject: [PATCH] config test --- statistiques/getStats.py | 5 +++++ 1 file changed, 5 insertions(+) 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__':