sql-join-test #1
|
@ -96,16 +96,24 @@ class MatchStore:
|
||||||
print("Representation step already done, skipping")
|
print("Representation step already done, skipping")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
num_inserts = 1000
|
||||||
|
inserts = []
|
||||||
|
|
||||||
structures_dict = {s.id: s for s in structures}
|
structures_dict = {s.id: s for s in structures}
|
||||||
num_representations = int(self.db.execute("SELECT Count(*) FROM Colocations").fetchone()[0])
|
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):
|
for cid, sid in progress(self.db.execute("SELECT colocation_id, structure_id FROM Colocations"), "representations", total=num_representations):
|
||||||
structure = structures_dict[sid]
|
structure = structures_dict[sid]
|
||||||
match = StructureMatch.from_db(self.db, cid, structure)
|
match = StructureMatch.from_db(self.db, cid, structure)
|
||||||
RepresentationAssigner.set_representations(match, word_renderer)
|
RepresentationAssigner.set_representations(match, word_renderer)
|
||||||
|
|
||||||
|
inserts.append(match)
|
||||||
|
if len(inserts) > num_inserts:
|
||||||
|
for match in inserts:
|
||||||
for component_id, text in match.representations.items():
|
for component_id, text in match.representations.items():
|
||||||
self.db.execute("""
|
self.db.execute("""
|
||||||
INSERT INTO Representations (colocation_id, component_id, text)
|
INSERT INTO Representations (colocation_id, component_id, text)
|
||||||
VALUES (?,?,?)""", (match.match_id, component_id, text))
|
VALUES (?,?,?)""", (match.match_id, component_id, text))
|
||||||
|
inserts = []
|
||||||
|
|
||||||
self.db.step_is_done(step_name)
|
self.db.step_is_done(step_name)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user