# Snowpipe with dbt

**URL:** <https://discourse.getdbt.com/t/snowpipe-with-dbt/9583>\
**Category:** Help\
**Tags:** snowflake, macro, macros\
**Created:** [August 16, 2023, 8:25pm UTC](https://discourse.getdbt.com/t/snowpipe-with-dbt/9583 "2023-08-16T20:25:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![roberbonox](https://avatars.discourse-cdn.com/v4/letter/r/3e96dc/32.png) [@roberbonox](https://discourse.getdbt.com/u/roberbonox)\
**Post date:** [August 16, 2023, 8:25pm UTC](https://discourse.getdbt.com/t/snowpipe-with-dbt/9583/1 "2023-08-16T20:25:21Z")

</div>

Hi, in my company we already have a pipeline developed in snowflake in which through external stages and snowpipe se load daily objects (csv files) from and S3 bucket to a table. After that, a process through streams, tasks, sp, etc process the data into a final table. Now we are asked to move all the logic of the process to dbt.

I’m very new to the tool so as suspected i’m having a lot of troubles to understand how to move the logic of this objects in snowflake to dbt. The first problem thats araising is, through a cawa we are gonna call the copy into thats inside of a snowpipe to load the data on a specific table.

For now i only tried to use a model that only have this (not the part of the cawa configuration, thats aside):

load\_table.sql:

{{ config(  
pre\_hook = “{{ name\_of\_a\_macro\_in\_another\_folder(‘name\_of\_the\_table’) }}”)  
}}

And the macro looks like this:

{% macro name\_of\_a\_macro\_in\_another\_folder(table) %}  
{{ log(“load starts”, True) }}  
{% set dml\_transaction -%}  
begin;  
COPY INTO DB.SCHEMA.{{table}}  
FROM ‘@STAGE/{{table}}’ ------- I’m not creating this stage on dbt cause the stage already exists in snowflake as i mentioned  
FILE\_FORMAT = (TYPE = ‘csv’ FIELD\_DELIMITER = ‘;’ SKIP\_HEADER = 1 EMPTY\_FIELD\_AS\_NULL = TRUE NULL\_IF = (‘’) RECORD\_DELIMITER = ‘\n’ FIELD\_OPTIONALLY\_ENCLOSED\_BY = ‘"’ ESCAPE\_UNENCLOSED\_FIELD =‘\’)  
ON\_ERROR = CONTINUE  
FORCE = TRUE;  
commit;  
{%- endset %}  
{{ log(“load ends”, True) }}  
{% endmacro %}

The problem is when i run: dbt run --select load\_table

The error is indicating that the execution of the “load\_table” model is not calling the macro, instead calls another model that has nothing to do with it,

Thoughts?

Thanks
