forked from duneanalytics/spellbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow for local compile of incremental models. (duneanalytics#2403)
* base is_incremental * add force-incremental variable
- Loading branch information
Showing
2 changed files
with
26 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% macro is_incremental() %} | ||
{#-- allow for command line compile of incremental models #} | ||
{#-- Usage: dbt compile --vars '{force-incremental: True}' #} | ||
{% if var('force-incremental', False) %} | ||
{{ return(True) }} | ||
{% endif %} | ||
|
||
{#-- do not run introspective queries in parsing #} | ||
{% if not execute %} | ||
{{ return(False) }} | ||
{% else %} | ||
{% set relation = adapter.get_relation(this.database, this.schema, this.table) %} | ||
{{ return(relation is not none | ||
and relation.type == 'table' | ||
and model.config.materialized == 'incremental' | ||
and not should_full_refresh()) }} | ||
{% endif %} | ||
{% 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