-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fixes #1292) Check for relation type in is_incremental()
If the target relation is a non-table (probably a view) then dbt should return False from the is_incremental() macro. The materialization will drop this relation before running the model code as a `create table as` statement, so the incremental filter would likely be invalid.
- Loading branch information
Showing
2 changed files
with
6 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
6 changes: 5 additions & 1 deletion
6
test/integration/035_changing_relation_type_test/models/model.sql
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,5 +1,9 @@ | ||
|
||
|
||
{{ config(materialized=var('materialized'), sql_where='TRUE') }} | ||
{{ config(materialized=var('materialized')) }} | ||
|
||
select '{{ var("materialized") }}' as materialization | ||
|
||
{% if var('materialized') == 'incremental' and is_incremental() %} | ||
where 'abc' != (select max(materialization) from {{ this }}) | ||
{% endif %} |