12 title = "%i entities to fix" % len(rset) |
12 title = "%i entities to fix" % len(rset) |
13 nbops = rset.rowcount |
13 nbops = rset.rowcount |
14 enabled = interactive_mode |
14 enabled = interactive_mode |
15 with progress(title=title, nbops=nbops, size=30, enabled=enabled) as pb: |
15 with progress(title=title, nbops=nbops, size=30, enabled=enabled) as pb: |
16 for i, row in enumerate(rset): |
16 for i, row in enumerate(rset): |
17 with hooks_control(session, session.HOOKS_DENY_ALL, 'integrity'): |
17 with session.deny_all_hooks_but('integrity'): |
18 data = {'eid': row[0], 'cwuri': row[1].replace(u'/eid', u'')} |
18 data = {'eid': row[0], 'cwuri': row[1].replace(u'/eid', u'')} |
19 rql('SET X cwuri %(cwuri)s WHERE X eid %(eid)s', data) |
19 rql('SET X cwuri %(cwuri)s WHERE X eid %(eid)s', data) |
20 if not i % 100: # commit every 100 entities to limit memory consumption |
20 if not i % 100: # commit every 100 entities to limit memory consumption |
21 pb.text = "%i committed" % i |
21 pb.text = "%i committed" % i |
22 commit(ask_confirm=False) |
22 commit(ask_confirm=False) |