I would like to mount a Prefect Secret into a file on my flow.
I have done this using a shell task but there is no write file task in the files tasks File and Filesystem Tasks | Prefect Docs. Is there a task I should be using instead to do this?
Dealing with keys and permissions would be easier in some cases if we could just assume that a secret is written to a given file either as the flow starts. It would also be cool to do this for environment variables, but maybe that is possible already?
I would also settle for best practices configuring ~/.dbt/profiles.yaml for orchestrating DBTShellTasks. How are people providing or overriding profiles in their flows?
For 1.0, one pattern you may follow is described here:
Essentially you would store all sensitive dbt profile information in your Prefect Secrets and reference those in the DbtShellTask.
–
For Prefect 2.0 though, we provide much easier building blocks to do that, which are literally called Blocks. You can store all your sensitive data there and reference it on your prefect-dbt tasks as shown here:
For reference here is dbt collection:
Another alternative, although not secure, would be baking your dbt profile file into your container image and reference the path on the DbtShellTask
Hi Anna! For Prefect1, It would seem then that the suggested practice is to, rather than using a file at all, set a json secret for the params that would normally go into the profile and then pass them to dbt_kwargs along with overwrite_profiles=True in my DbtShellTask?
You’re right, it’s because this collection hasn’t been officially released. We are working on it and will announce it once it’s published - if you follow the dbt tag, you can get an email notification once we release that - Topics tagged dbt
ooh awesome! Looking forward to that release and I am just researching for an upcoming project at this point so timeline is no problem for me and my team Thanks for your help, I feel prepared now