https://prefect.io logo
Title
h

Henrietta Salonen

02/14/2022, 2:32 PM
Hello, This may be something simple that I’m just totally overlooking but trying to use the s3.s3Upload.run in my flow in the following way:
with Flow("test") as flow:
    s3.S3Upload.run(data, credentials="AWS_CREDENTIALS", bucket='bucket_name', compression='gzip')

flow.run()
Data is json string. I keep on getting this error
AttributeError: 'str' object has no attribute 'bucket'
k

Kevin Kho

02/14/2022, 2:34 PM
You shouldn’t call the
run()
method inside the Flow. I don’t know if this will help but try:
with Flow(..) as flow:
    S3Upload(init_stuff_here)(run_stuff_here)
h

Henrietta Salonen

02/14/2022, 2:38 PM
Hey do you mean like this:
with Flow("test") as flow:
    s3.S3Upload(data, credentials="AWS_CREDENTIALS", bucket='bucket_name', compression='gzip')

flow.run()
k

Kevin Kho

02/14/2022, 2:40 PM
no you need 2 parenthesis. either:
s = S3Upload()
with Flow(..) as flow:
    s()
or:
with Flow(..) as flow:
    S3Upload()()
h

Henrietta Salonen

02/14/2022, 2:54 PM
cheers, that was it! Thank you 🙂
k

Kevin Kho

02/14/2022, 3:00 PM
Nice!