-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix warehouse_size macro to properly activate the warehouse * Fix README and add if execute conditions
- Loading branch information
1 parent
8ad11af
commit 9ac2be4
Showing
3 changed files
with
35 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
{% macro warehouse_size() %} | ||
|
||
{% if execute and model.config.materialized == 'incremental' %} | ||
{% set initial_wh = var('snowflake_utils:initial_run_warehouse', none) %} | ||
{% set full_wh = var('snowflake_utils:full_refresh_run_warehouse', none) %} | ||
{% set inc_wh = var('snowflake_utils:incremental_run_warehouse', none) %} | ||
|
||
{% set relation = adapter.get_relation(this.database, this.schema, this.table) %} | ||
{% set relation = adapter.get_relation(this.database, this.schema, this.table) %} | ||
|
||
{% set initial_wh = var('snowflake_utils:initial_run_warehouse', none) %} | ||
{% set full_wh = var('snowflake_utils:full_refresh_run_warehouse', none) %} | ||
{% set inc_wh = var('snowflake_utils:incremental_run_warehouse', none) %} | ||
|
||
{#-- use alternative warehouse if initial run #} | ||
{% if relation is none and initial_wh is not none %} | ||
{{ dbt_utils.log_info("Initial Run - Using alternative warehouse " ~ initial_wh | upper) }} | ||
{% do return(initial_wh) %} | ||
|
||
{#-- use alternative warehouse if full-refresh run #} | ||
{% elif flags.FULL_REFRESH and full_wh is not none %} | ||
{#-- use alternative warehouse if full-refresh run #} | ||
{# if relation is not none and flags.FULL_REFRESH and full_wh is not none #} | ||
{% if flags.FULL_REFRESH and full_wh is not none %} | ||
{% if execute %} | ||
{{ dbt_utils.log_info("Full Refresh Run - Using alternative warehouse " ~ full_wh | upper) }} | ||
{% do return(full_wh) %} | ||
|
||
{#-- use target warehouse if variable not configured for a condition #} | ||
{% else %} | ||
{{ dbt_utils.log_info("Using target warehouse " ~ target.warehouse | upper) }} | ||
{% do return(target.warehouse) %} | ||
{% endif %} | ||
{% do return(full_wh) %} | ||
|
||
{#-- use alternative warehouse if incremental run #} | ||
{% elif relation is not none and flags.FULL_REFRESH == False and inc_wh is not none %} | ||
{% if execute %} | ||
{{ dbt_utils.log_info("Incremental Run - Using alternative warehouse " ~ inc_wh | upper) }} | ||
{% endif %} | ||
{% do return(inc_wh) %} | ||
|
||
{#-- use target warehouse if model is not incremental #} | ||
{% elif execute and model.config.materialized != 'incremental' %} | ||
{{ dbt_utils.log_info("Using target warehouse " ~ target.warehouse | upper) }} | ||
{% do return(target.warehouse) %} | ||
{#-- use alternative warehouse if initial run #} | ||
{% elif relation is none and initial_wh is not none %} | ||
{% if execute %} | ||
{{ dbt_utils.log_info("Initial Run - Using alternative warehouse " ~ initial_wh | upper) }} | ||
{% endif %} | ||
{% do return(initial_wh) %} | ||
|
||
{#-- use target warehouse for parsing #} | ||
{#-- use target warehouse if variable not configured for a condition #} | ||
{% else %} | ||
{{ dbt_utils.log_info("Using target warehouse " ~ target.warehouse | upper) }} | ||
{% do return(target.warehouse) %} | ||
|
||
{% endif %} | ||
|
||
{% endmacro %} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
packages: | ||
- package: dbt-labs/dbt_utils | ||
version: ">=0.1.25" | ||
version: ">=0.7.0" |