Hey, something that’s taken me a while to figure out and probably worth adding to your post: we were getting errors in our build pipeline because we added a model and then referenced it in a UDF in the same pull request, which then triggered a build starting with dbt seed
. When the on-run-end
hook ran, it failed because it was referencing models that didn’t exist.
I managed to resolve this by using the WHICH
flag (new in dbt 1.0) as follows:
{% macro create_udfs() %}
{% if flags.WHICH == "run" %}
{{ create_unbilled_volume_report() }}
{% else %}
select 1 as id
{% endif %}
{% endmacro %}