added function to insert one translated content
This commit is contained in:
@@ -171,6 +171,17 @@ def insert_list(username_list, timestamp_list, content_list):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.warning(e)
|
logging.warning(e)
|
||||||
|
|
||||||
|
def insert_translated(val_dict):
|
||||||
|
assert 'id' in val_dict.keys()
|
||||||
|
assert 'content_en' in val_dict.keys()
|
||||||
|
with Data_table() as dt:
|
||||||
|
query = (
|
||||||
|
f'UPDATE {dt._name} '
|
||||||
|
' SET content_en = (%(content_en)s) '
|
||||||
|
'WHERE id = (%(id)s) '
|
||||||
|
)
|
||||||
|
dt.execute(query, val_dict)
|
||||||
|
|
||||||
def insert_translated_list(content_list, id_list):
|
def insert_translated_list(content_list, id_list):
|
||||||
with Data_table() as dt:
|
with Data_table() as dt:
|
||||||
for id, content in zip(id_list, content_list):
|
for id, content in zip(id_list, content_list):
|
||||||
|
|||||||
Reference in New Issue
Block a user