The empty sources section is meaningless, so I use yq to delete the sources section every time (yq --inplace 'del(.sources)' models/my_model.yml is executed).
It's tedious to perform this file operation every time, so I modified it to delete them if sources or models are empty in the yaml generated by running dbt-osmosis yaml refactor.
Why
I use dbt-osmosis with the following settings written in
dbt_project.yml
. This means there is one yaml file for each model.sources
are managed in a separate yaml. When runningdbt-osmosis yaml refactor
with this setting, an emptysources
setting is output to the yaml file.The empty
sources
section is meaningless, so I use yq to delete thesources
section every time (yq --inplace 'del(.sources)' models/my_model.yml
is executed).It's tedious to perform this file operation every time, so I modified it to delete them if
sources
ormodels
are empty in the yaml generated by runningdbt-osmosis yaml refactor
.