Search code examples
jinja2dbt

dbt invoke post-hook macro with list argument


I'm trying to invoke a macro as a post-hook. The trouble is (I think) is that I'd like to pass a list to this macro... any idea what's going on here? My theory is that I'm passing a list type argument.

-- models/table.sql
{{
  config(
    materialized = 'table',
    post-hook = "{{ my_macro(this,'my_str', ['foo', 'bar']) }}"
    )
}}

SELECT * FROM muh_tayble;
-- macros/my_macro.sql
{% macro my_macro(relation, string, list) %}
 BLAH
{% endmacro %}

error message

Encountered an error:
Compilation Error in model table (models/table.sql)
  invalid syntax for function call expression
    line 2

Solution

  • Rookie mistake folks. I had post-hook instead of post_hook. Problem solved