From 33c307da4334467ee396d091475fa72d62d60014 Mon Sep 17 00:00:00 2001 From: simplypower-bbj Date: Sat, 17 Dec 2022 00:49:27 +0100 Subject: [PATCH] added function to insert data --- database.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/database.py b/database.py index c18a096..3e5be74 100644 --- a/database.py +++ b/database.py @@ -147,4 +147,13 @@ class Data_table(Table): 'ON CONFLICT (username, time, content) DO NOTHING ' ';' ) - self.execute(query, val_dict) \ No newline at end of file + self.execute(query, val_dict) + +def insert(username, timestamp, content): + val_dict = { + 'username': username, + 'time': timestamp, + 'content': content + } + with Data_table() as dt: + dt.insert(val_dict) \ No newline at end of file