For S3Result.write(), *Returns*: - `Result`: a n...
# ask-community
c
For S3Result.write(), Returns: • `Result`: a new Result instance with the appropriately formatted S3 URI I wasn't able to return the formatted S3 URI, only the S3 Result itself. Any pointers? I'm doing:
Copy code
data = results.write(df, **prefect.context)
print(data)
k
Hey again, do you see any of the logs?
c
Yeah I'm looking in the logs and the only output is the S3 Result in the form of the table i uploaded
k
The result gets written to S3 successfully?
c
yup! just double checked
k
Ah actually can you show me how you’re using the Result in the Flow?
c
Copy code
bucket = "bucket"
location = "location"

MY_RESULTS = S3Result(...)

@task 
def func():
   foo
   bar = MY_RESULTS.write()
   print(bar)

with Flow():
   client_secret = ...
   first_step = ...
   second_step = ...
assume multiple tasks for the different steps
hope that's helpful! sorry wasn't sure how to exactly describe it haha
k
Maybe try it inside the task ? If this doesn’t work I can try it later.
Just making sure, what version of Prefect are you on?
c
0.14.2 i believe
also no, putting it inside the task didn't change anything
thanks for the insight thus far!
a
What if you print
bar.value
?
Wait no, that would be the value, not the location, sorry.
Ah, but then that makes sense:
bar.location
might be it
🤞 1
c
hey that worked!
huge! thank you!
k
Thanks! @Amanda Wee
a
You're welcome!
c
It returns literal location, just for anyone who comes across this
In: bar = S3Result(location = foo), after using fizz=bar.write() and then returning fizz.location, you return foo.
a
Yeah, I'm looking at the code, and I think the comment is misleading/outdated.
write
returns the
Result
, which overrides
__repr__
to print type and value, not the full location URI. You can construct the full location URI from the
bucket
and
location
attributes, but not directly.
k
@Marvin open “S3Result write Docstring Misleadingly Says It Returns URI”
k
Thanks for the feedback and discussion @Amanda Wee! @Charles Liu!
c
Passing the Result as a whole to the next task; I reconstructed the URI with string concat (s3://{bucket}/{location}) and declaring the Result.location or bucket, thanks @Amanda Wee!