which gives me a dates and references to run a procedure in snowflake. I envoke the run of the procedure with a macro in dbt:
{% macro iq_model_run_liability_benchmark() %}
{{ log(“Running iq_model_run_liability_benchmark”, info=True) }}
{% set table_ref = ref(‘stg_liability_benchmarks_dates’) %}
{% set query %}
SELECT LBP_ID, EFFECTIVE_DATE
FROM {{ table_ref }}
{% endset %}
{% set results = run_query(query) %}
{% for row in results.rows %}
{% set sql_statement %}
CALL IGG_IQ_DEV.IQ_MODEL.RUN_TASK_LIABILITY_BENCHMARK(True,'{{ row["EFFECTIVE_DATE"] }}','{{ row["LBP_ID"] }}');
{% endset %}
{% do run_query(sql_statement) %}
{% endfor %}
{% endmacro %}
This works if i manually run-operation iq_model_run_liability_benchmark after the model stg_liability_benchmarks_dates has run. However i need this to run in sequence of the rest of the models. Namely the macro to run after the stg_liability_benchmarks_dates is finished executing.
I have tried post-hook as a configuration and in the dbt_project.yml as per this:
liabilities:
+materialized: table
+schema: liabilities # Matches the folder and schema name
stg_liability_benchmarks_dates:
+post-hook: "{{iq_model_run_liability_benchmark()}}"
But i get the error: Encountered an error:
Compilation Error in model stg_liability_benchmarks_dates (models/liabilities/stg_liability_benchmarks_dates.sql)
‘None’ has no attribute ‘table’
Any idea how to get this to run as a post-hook operation?