Hi everyone. I am developing a simple flow that ha...
# prefect-community
p
Hi everyone. I am developing a simple flow that has to query a database, save a file as csv, run some checks and SFTP the file over to a remote server. The query takes a while to run so I am using a templated
target
and
PandasSerializer
to write the csv. I am wondering what the recommended pattern is for the downstream SFTP task to locate the csv. If I were not relying on the
LocalResult
to save the file, I'd simply return the path to the local file from the function that generates the csv. However, since I am using the
Result
mechanism, this task just returns a dataframe. Do I just have to rely on the templated
target
location for downstream tasks to find the csv file? In other words, do I have to use the same template and render it manually in the SFTP task?
j
The results mechanism in prefect is mostly for efficiently caching tasks to not recompute, and possibly inspect the results later for bugs. Since the file you're generating also seems to be part of your workload (not just caching a step), I recommend writing the file to a csv as part of the task and returning the filename directly. I wouldn't use results at all here.
👍 1