diff --git a/dbt/include/fabric/macros/materializations/hooks.sql b/dbt/include/fabric/macros/materializations/hooks.sql new file mode 100644 index 00000000..39bf2d74 --- /dev/null +++ b/dbt/include/fabric/macros/materializations/hooks.sql @@ -0,0 +1,10 @@ +{% macro run_hooks(hooks, inside_transaction=True) %} + {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %} + {% set rendered = render(hook.get('sql')) | trim %} + {% if (rendered | length) > 0 %} + {% call statement(auto_begin=inside_transaction) %} + {{ rendered }} + {% endcall %} + {% endif %} + {% endfor %} +{% endmacro %}