Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/migrate_extrinsic_metadata.py
Show First 20 Lines • Show All 1,109 Lines • ▼ Show 20 Lines | def iter_revision_rows(storage_dbconn: str, first_id: Sha1Git): | ||||
failures = 0 | failures = 0 | ||||
while True: | while True: | ||||
try: | try: | ||||
storage_db = BaseDb.connect(storage_dbconn) | storage_db = BaseDb.connect(storage_dbconn) | ||||
with storage_db.cursor() as cur: | with storage_db.cursor() as cur: | ||||
while True: | while True: | ||||
cur.execute( | cur.execute( | ||||
f"SELECT {', '.join(REVISION_COLS)} FROM revision " | f"SELECT {', '.join(REVISION_COLS)} FROM revision " | ||||
f"WHERE id > %s AND metadata IS NOT NULL " | f"WHERE id > %s AND metadata IS NOT NULL AND type != 'git'" | ||||
f"ORDER BY id LIMIT 1000", | f"ORDER BY id LIMIT 1000", | ||||
(after_id,), | (after_id,), | ||||
) | ) | ||||
new_rows = 0 | new_rows = 0 | ||||
for row in cur: | for row in cur: | ||||
new_rows += 1 | new_rows += 1 | ||||
row_d = dict(zip(REVISION_COLS, row)) | row_d = dict(zip(REVISION_COLS, row)) | ||||
yield row_d | yield row_d | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |