Hi everyone! I’m trying to use an S3List task <htt...
# prefect-community
f
Hi everyone! I’m trying to use an S3List task https://docs.prefect.io/api/latest/tasks/aws.html#s3list but it seems like the bucket prefix is not an optional value even though it should be? 🤔 Boto3 docs lists it as optional (https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.list_objects), but the task implementation doesn’t (see screenshot). This is what I try to do:
Copy code
s3_list_task = S3List()

        flow.set_dependencies(
            task=s3_list_task,
            keyword_tasks=dict(
                bucket='my-bucket-name'
            )
        )
And this is the error message:
Copy code
TypeError: run() missing 1 required positional argument: 'prefix'
Does this mean I can’t use buckets without prefixes together with the S3 prefect tasks?
k
Ah I think we’d take a PR to fix that. Maybe you can try empty string as a workaround?
👌 1
f
@Kevin Kho I tried that and it returns this error (which makes sense):
Copy code
botocore.errorfactory.NoSuchBucket: An error occurred (NoSuchBucket) when calling the ListObjectsV2 operation: The specified bucket does not exist
Ok I’ll use the boto3 api directly then! So far not having the best experience with prefect tasks: snowflake tasks and s3 tasks are a womp womp for me 😓
@Kevin Kho UPDATE: the workaround with the empty string actually worked!! Sorry about that, I had a typo in the bucket name when I initially tried that 😅
k
Ah ok I was wondering why that would cause a wrong bucket, but thought i just didnt understand something. Glad you got it working
🙏 1
👌 1
f
@Kevin Kho Can i open PR to assign default prefix to empty string?
k
Yeah man go for it. I think that makes sense! Have you done it before? Give it a try and ask me if you need anything?