Is there any issue with wrapping tasks together? F...
# ask-community
s
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
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
Yeah I think
f-string
is probably just the way to go here. Good to know for general concepts though, thanks Kevin