Testing delayed insertions of representations
This commit is contained in:
parent
6bb3586051
commit
8fee3f8a8e
|
@ -96,16 +96,24 @@ class MatchStore:
|
|||
print("Representation step already done, skipping")
|
||||
return
|
||||
|
||||
num_inserts = 1000
|
||||
inserts = []
|
||||
|
||||
structures_dict = {s.id: s for s in structures}
|
||||
num_representations = int(self.db.execute("SELECT Count(*) FROM Colocations").fetchone()[0])
|
||||
for cid, sid in progress(self.db.execute("SELECT colocation_id, structure_id FROM Colocations"), "representations", total=num_representations):
|
||||
structure = structures_dict[sid]
|
||||
match = StructureMatch.from_db(self.db, cid, structure)
|
||||
RepresentationAssigner.set_representations(match, word_renderer)
|
||||
for component_id, text in match.representations.items():
|
||||
self.db.execute("""
|
||||
INSERT INTO Representations (colocation_id, component_id, text)
|
||||
VALUES (?,?,?)""", (match.match_id, component_id, text))
|
||||
|
||||
inserts.append(match)
|
||||
if len(inserts) > num_inserts:
|
||||
for match in inserts:
|
||||
for component_id, text in match.representations.items():
|
||||
self.db.execute("""
|
||||
INSERT INTO Representations (colocation_id, component_id, text)
|
||||
VALUES (?,?,?)""", (match.match_id, component_id, text))
|
||||
inserts = []
|
||||
|
||||
self.db.step_is_done(step_name)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user