added function to insert data
This commit is contained in:
+10
-1
@@ -147,4 +147,13 @@ class Data_table(Table):
|
|||||||
'ON CONFLICT (username, time, content) DO NOTHING '
|
'ON CONFLICT (username, time, content) DO NOTHING '
|
||||||
';'
|
';'
|
||||||
)
|
)
|
||||||
self.execute(query, val_dict)
|
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)
|
||||||
Reference in New Issue
Block a user