added function to insert lists of data
This commit is contained in:
@@ -157,3 +157,16 @@ def insert(username, timestamp, content):
|
|||||||
}
|
}
|
||||||
with Data_table() as dt:
|
with Data_table() as dt:
|
||||||
dt.insert(val_dict)
|
dt.insert(val_dict)
|
||||||
|
|
||||||
|
def insert_list(username_list, timestamp_list, content_list):
|
||||||
|
with Data_table() as dt:
|
||||||
|
for username, timestamp, content in zip(username_list, timestamp_list, content_list):
|
||||||
|
try:
|
||||||
|
val_dict = {
|
||||||
|
'username': username,
|
||||||
|
'time': timestamp,
|
||||||
|
'content': content
|
||||||
|
}
|
||||||
|
dt.insert(val_dict)
|
||||||
|
except Exception as e:
|
||||||
|
logging.warning(e)
|
||||||
Reference in New Issue
Block a user