Commit 9ff00ce2 authored by Romain Loth's avatar Romain Loth

dbcrud: fix unique pairs user <=> keyword before insert

parent 32185ab9
...@@ -520,9 +520,10 @@ def update_scholar_cols(selected_safe_recs, cmx_db, where_luid=None): ...@@ -520,9 +520,10 @@ def update_scholar_cols(selected_safe_recs, cmx_db, where_luid=None):
def save_pairs_sch_tok(pairings_list, cmx_db, map_table='sch_kw'): def save_pairs_sch_tok(pairings_list, cmx_db, map_table='sch_kw'):
""" """
Simply save all pairings (luid, kwid) or (luid, htid) in the list Simply save all pairings (luid, kwid) or (luid, htid) in the list
@pairings_list: list of tuples
""" """
db_cursor = cmx_db.cursor() db_cursor = cmx_db.cursor()
for id_pair in pairings_list: for id_pair in set(pairings_list):
db_cursor.execute('INSERT INTO %s VALUES %s' % (map_table, str(id_pair))) db_cursor.execute('INSERT INTO %s VALUES %s' % (map_table, str(id_pair)))
cmx_db.commit() cmx_db.commit()
mlog("DEBUG", "%s: saved %s pair" % (map_table, str(id_pair))) mlog("DEBUG", "%s: saved %s pair" % (map_table, str(id_pair)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment