Is invocation_id in macro differ from model in dbt?

I have a model inserting {{invocation_id}} as one of fields into table:

select '{{invocation_id}}' as invocation_id from table

I also have post_hook that calls a macro that calls a procedure. Procedure updates a log table using invocation id:

{{
  config(
    post_hook = prestg_to_stg("{{ this.name }}")
  )
}}
{% macro prestg_to_stg(p_src_tbl_nm) %}

  select prestg.prestg_to_stg('{{ p_src_tbl_nm }}', '{{ invocation_id }}')

{% endmacro %}

And I was surprised to find that invocation_id in macro is differ from one in model. Yes, I can pass invocation_id as parameter but I’d like to know is it bug or feature.

Thank you.

Leave a Comment