The problem I’m having
I want to generate yml files to the target folder in macro.
Is that possible?
Thank you.
I want to generate yml files to the target folder in macro.
Is that possible?
Thank you.
can you provide more dwtails.
@Surya Thank you for your reply.
For example, I create a macro like generate_yaml_for_model.sql.
Then, I set a string variable like model_yaml with the yaml content of a model.
Finally, I want to output the value of the variable to a physical file like model.yml to a subdirectory in the target folder.
In summary, I want to know if we can create/modify/delete folders and files in target folder from a macro.
Thank you.
Looking for a reply.
I think its not possible with sql models but it migt be possible with dbt python models.
dbt python models are py files u can write python code to read and write to files
Hi guys, any ideas?
Thank you.
Creating files from macros is not possible
But u can do onething create a python dbt model and write ur code there to generate yml file and run the model
I didn’t try this. U can give a try
you can try below
dbt run-operation macroname --args ‘{a: b}’ > ./myfile.yml
it wont be a structured output but you can perform more operations on the string log saved in it