run macro on_run_end in dbt_project.yml problem

Hi ! I tried to run on_run_end macro on my dbt_project.yml and I get a message:

Could not render {{ my_macro() }}: ‘my_macro’ is undefined

The macro exists on macro folder and this is my dbt_project.yml line:


Config indicated by + and applies to all files under models/example/

  +materialized: view
  +enabled: true      
  +materialized: incremental
  +enabled: true
  on-run-end: "{{ my_macro() }}"

What´s the problem on my code ?


Could you post the macro?

Note: @nlawrence originally posted this reply in Slack. It might not have transferred perfectly.

1 Like

Hi ! Sure !

{% macro my_macro() %}

{% if execute %}

    update {{ source( 'visao360', 'dim_cadastro' ) }} set ind_documento_valido = {{ valida_num_documento() }} 
    where num_documento_tratado is not null
    and cod_retorno = 0;   

{% endif %}

{% endmacro %}

You have placed on-run-end at wrong place, both on-run-end and models should be at same height

1 Like

thank you so much, @Surya
it worked !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.