From 268e40d0a3318cedbc272177fe84c114717ad537 Mon Sep 17 00:00:00 2001 From: Jakob van Santen Date: Fri, 16 Feb 2024 09:39:09 +0100 Subject: [PATCH] fixup! fixup! fixup! fixup! fixup! clean up orphaned blobs --- migrations/02_add_archive_count.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/migrations/02_add_archive_count.py b/migrations/02_add_archive_count.py index 0d6113c..a3ba399 100644 --- a/migrations/02_add_archive_count.py +++ b/migrations/02_add_archive_count.py @@ -93,13 +93,17 @@ ) ).returning(Archive.c.uri) with connection.begin() as transaction: + for row in transaction.execute(statement).fetchall(): + key = get_key_for_url(bucket, row["uri"]) + print(f"delete {key}") + # bucket.Object(key).delete() transaction.rollback() # print( # statement.compile( # dialect=engine.dialect, compile_kwargs={"literal_binds": True} # ) # ) - # sys.exit(0) + sys.exit(0) in_bucket = {summary.key: summary.size for summary in bucket.objects.all()} print(