-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add trino__equality_fct_source_fanout test
- Loading branch information
1 parent
ae411c5
commit bf1f784
Showing
4 changed files
with
51 additions
and
0 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
30 changes: 30 additions & 0 deletions
30
integration_tests/dbt_project_evaluator/models/marts/dag/trino__fct_source_fanout.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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- this model finds cases where a source is used in multiple direct downstream models | ||
with direct_source_relationships as ( | ||
select | ||
* | ||
from {{ ref('int_all_dag_relationships') }} | ||
where distance = 1 | ||
and parent_resource_type = 'source' | ||
and child_resource_type = 'model' | ||
and not parent_is_excluded | ||
and not child_is_excluded | ||
-- we order the CTE so that listagg returns values correctly sorted for some warehouses | ||
order by child | ||
), | ||
|
||
source_fanout as ( | ||
select | ||
parent, | ||
{{ dbt.listagg( | ||
measure='child', | ||
delimiter_text="', '", | ||
order_by_clause='order by child') | ||
}} as model_children | ||
from direct_source_relationships | ||
group by 1 | ||
having count(*) > 1 | ||
) | ||
|
||
select * from source_fanout | ||
|
||
{{ trino__filter_exceptions(model.name) }} |
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
3 changes: 3 additions & 0 deletions
3
integration_tests/dbt_project_evaluator/seeds/dag/trino__test_fct_source_fanout.csv
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,3 @@ | ||
parent,model_children | ||
source_1.table_2,"int_model_4, stg_model_2" | ||
source_1.table_1,"stg_model_1, stg_model_2" |