Doing so would violate the database constraints.
query = "SELECT path FROM hashfile WHERE suite_id = :id"
q = session.execute(query, {'id': self.suite.suite_id})
known_hashfiles = set(row[0] for row in q)
query = "SELECT path FROM hashfile WHERE suite_id = :id"
q = session.execute(query, {'id': self.suite.suite_id})
known_hashfiles = set(row[0] for row in q)
- updated = []
- new = []
+ updated = set()
+ new = set()
# Update the hashfile table with new or updated files
for filename in fileinfo:
# Update the hashfile table with new or updated files
for filename in fileinfo:
field = h.release_field
hashfile = os.path.join(byhashdir, field, fileinfo[filename][field])
if hashfile in known_hashfiles:
field = h.release_field
hashfile = os.path.join(byhashdir, field, fileinfo[filename][field])
if hashfile in known_hashfiles:
- updated.append(hashfile)
if updated:
session.execute("""
UPDATE hashfile SET unreferenced = NULL
WHERE path = ANY(:p) AND suite_id = :id""",
if updated:
session.execute("""
UPDATE hashfile SET unreferenced = NULL
WHERE path = ANY(:p) AND suite_id = :id""",
- {'p': updated, 'id': self.suite.suite_id})
+ {'p': list(updated), 'id': self.suite.suite_id})
if new:
session.execute("""
INSERT INTO hashfile (path, suite_id)
if new:
session.execute("""
INSERT INTO hashfile (path, suite_id)