# HG changeset patch # User Sylvain Thénault # Date 1300969814 -3600 # Node ID 63f0bc2803546bf3c3b582707c421c2c697d1d92 # Parent aefd1776122fdab45486d8f3a5aeaef2390f8359 [migration] Lesser memory consumption of cwuri fix + actually commit every 100 processed entities Don't use the ORM as added value is poor while all intentiated object are keept by rset cache. diff -r aefd1776122f -r 63f0bc280354 misc/migration/3.10.9_Any.py --- a/misc/migration/3.10.9_Any.py Thu Mar 24 13:25:57 2011 +0100 +++ b/misc/migration/3.10.9_Any.py Thu Mar 24 13:30:14 2011 +0100 @@ -16,9 +16,10 @@ enabled = interactive_mode with progress(title=title, nbops=nbops, size=30, enabled=enabled) as pb: with hooks_control(session, session.HOOKS_DENY_ALL, 'integrity'): - for i, e in enumerate(rset.entities()): - e.set_attributes(cwuri=e.cwuri.replace('/eid', '')) - if i % 100: # commit every 100 entities to limit memory consumption + for i, row in enumerate(rset): + data = {'eid': row[0], 'cwuri': row[1].replace(u'/eid', u'')} + rql('SET X cwuri %(cwuri)s WHERE X eid %(eid)s', data) + if not i % 100: # commit every 100 entities to limit memory consumption pb.text = "%i committed" % i commit(ask_confirm=False) pb.update()