update instead of insert, fixing sentence duplication in db

This commit is contained in:
voje 2019-04-11 07:55:44 +02:00
parent 77c599dded
commit 2b7339ac5a

View File

@ -70,7 +70,8 @@ def data_to_valdb(sentence_generator, dbaddr, username, password, collection_nam
col = valdb[collection_name] col = valdb[collection_name]
for s in sentence_generator: for s in sentence_generator:
sdata = s[1] sdata = s[1]
col.insert_one(sdata) # col.insert_one(sdata)
col.update({"sid": sdata["sid"]}, sdata, upsert=True)
if __name__ == "__main__": if __name__ == "__main__":