config test
This commit is contained in:
parent
230f647c38
commit
5fbf657b1b
@ -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__':
|
||||
|
Loading…
Reference in New Issue
Block a user