Is there any issue with wrapping tasks together? For example, I want to use the
StringFormatter
but pass in a file that is opened…is something like this bad practice:
Copy code
@task
def format_sql_file(file):
with open(file, 'r') as sql:
string_to_format = sql.read()
return StringFormatter().run(var1='my_value', var2='other_value', template = string_to_format)
k
Kevin Kho
12/08/2021, 4:37 PM
Not necessarily. But for this specifically, what does StringFormatter give you that
f-string
format doesn’t? But using a task inside a task is not bad and it makes sense sometimes. I personally use the
SlackTask
inside other tasks to send messages out.
Especially for an operation like this (string formatting) that doesn’t need retries or observability of state, it should be fine.
s
Sam Werbalowsky
12/08/2021, 4:54 PM
Yeah I think
f-string
is probably just the way to go here. Good to know for general concepts though, thanks Kevin
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.