Hi Humans, I have a hopefully quick question that ...
# ask-community
f
Hi Humans, I have a hopefully quick question that I need help with. I am supporting a Prefect installation which I would like to clean up the code base since there is a lot of boilerplate, I am considering using a single python source file and add the necessary flow name, parameters and whatever else from a database query . But I realized that each flow must be registered so using a single python file this way may not work... So my question is will it work, and how would I register the individual flows? Thanks!!
k
Hi @Frederick Thomas, you can register multiple flows in the same file.
Copy code
with Flow("Parameter Sample") as flow:
    start_date = Parameter(name="start_date")
    abc(start_date)

with Flow("Parameter Sample") as flow1:
    end_date = Parameter(name="end_date")
    abc(end_date)

flow.register(..)
flow1.register(..)
CLI with
prefect register
will also register all the flows found in that file
f
My use case would then be to call all the flows within one file? 😃
k
Yes you can