diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ae2577..4bedfb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## dbt-external-tables VNEXT + + +### Snowflake +* Snowpipes should never refresh even if `auto_refresh` is set to `True` ([#250](https://github.com/dbt-labs/dbt-external-tables/issues/250) + ## dbt-external-tables v0.9.0 ### Snowflake diff --git a/macros/plugins/snowflake/get_external_build_plan.sql b/macros/plugins/snowflake/get_external_build_plan.sql index 807cbb5..c87b49c 100644 --- a/macros/plugins/snowflake/get_external_build_plan.sql +++ b/macros/plugins/snowflake/get_external_build_plan.sql @@ -20,7 +20,7 @@ dbt_external_tables.snowflake_create_snowpipe(source_node) ] %} {% else %} - {% set build_plan = build_plan + dbt_external_tables.snowflake_refresh_snowpipe(source_node) %} + {% set build_plan = build_plan + dbt_external_tables.refresh_external_table(source_node) %} {% endif %} {% else %} diff --git a/macros/plugins/snowflake/refresh_external_table.sql b/macros/plugins/snowflake/refresh_external_table.sql index accf182..e5237e6 100644 --- a/macros/plugins/snowflake/refresh_external_table.sql +++ b/macros/plugins/snowflake/refresh_external_table.sql @@ -19,6 +19,10 @@ {% do return([ddl]) %} + {% elif snowpipe is not none %} + + {% do return([]) %} + {% else %} {% do return([]) %} diff --git a/macros/plugins/snowflake/snowpipe/refresh_snowpipe.sql b/macros/plugins/snowflake/snowpipe/refresh_snowpipe.sql deleted file mode 100644 index cf80055..0000000 --- a/macros/plugins/snowflake/snowpipe/refresh_snowpipe.sql +++ /dev/null @@ -1,20 +0,0 @@ -{% macro snowflake_refresh_snowpipe(source_node) %} - - {% set snowpipe = source_node.external.snowpipe %} - {% set auto_ingest = snowpipe.get('auto_ingest', false) if snowpipe is mapping %} - - {% if auto_ingest is true %} - - {% do return([]) %} - - {% else %} - - {% set ddl %} - alter pipe {{source(source_node.source_name, source_node.name)}} refresh - {% endset %} - - {{ return([ddl]) }} - - {% endif %} - -{% endmacro %}