Skip to content

Commit 33fb3a7

Browse files
authored
Merge pull request #442 from dbt-labs/fix/fct_chained_views
2 parents bf2dbce + 4d94d9e commit 33fb3a7

File tree

4 files changed

+6
-24
lines changed

4 files changed

+6
-24
lines changed

integration_tests/dbt_project.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,5 @@ vars:
6767
new_model_type_folder_name: 'my_new_models'
6868
new_model_type_prefixes: 'nwmdl_'
6969
insert_batch_size: 100
70-
too_many_joins_threshold: 3
70+
too_many_joins_threshold: 3
71+
chained_views_threshold: 2
Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,2 @@
11
parent,child,distance
22
stg_model_1,dim_model_7,3
3-
stg_model_1,int_model_5,2
4-
stg_model_2,dim_model_7,2
5-
int_model_4,dim_model_7,2
6-
stg_model_1,dim_model_7,2
7-
stg_model_4,dim_model_7,1
8-
stg_model_2,stg_model_4,1
9-
int_model_4,int_model_5,1
10-
int_model_5,dim_model_7,1
11-
stg_model_1,int_model_5,1
12-
stg_model_1,int_model_4,1
13-
fct_model_9,stg_model_5,1
14-
stg_model_3,fct_model_6,1
15-
stg_model_1,fct_model_10,1
16-
stg_model_2,fct_model_10,1
17-
stg_model_3,fct_model_10,1

models/marts/performance/fct_chained_views_dependencies.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ final as (
1616
from all_relationships
1717
where is_dependent_on_chain_of_views
1818
and child_resource_type = 'model'
19+
and distance > {{ var('chained_views_threshold') }}
1920
)
2021

2122
select * from final

models/marts/performance/performance.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ models:
66
This returns models dependent on chains of "non-physically-materialized" models (views and ephemerals),
77
highlighting potential cases for improving performance by switching the materialization of model(s) within
88
the chain to table or incremental.
9-
columns:
10-
- name: distance
11-
tests:
12-
- dbt_utils.accepted_range:
13-
name: valid_chained_views_dependencies
14-
max_value: "{{ var('chained_views_threshold') }}"
15-
inclusive: false
16-
severity: warn
9+
tests:
10+
- is_empty:
11+
severity: warn

0 commit comments

Comments
 (0)