2

Background

Lets say I have 2 AWS S3 buckets, bucket_input and bucket_output.

I plan on iterating over the contents of bucket_input - performing some transformations on each object as I go - before saving them to bucket_output.

According to the following post Listing contents of a bucket with boto3, I can simply do the following

for object_input in bucket_input.objects.all():
    upload_to_output(transform(object_input))

Problem

How does the iteration of for object_input in bucket_input.objects.all(): behave when new objects are added/deleted from the bucket mid-iteration? And what are the best practices for how would I go about handling this for my use case?

AlanSTACK
  • 5,525
  • 3
  • 40
  • 99

0 Answers0