Skip to content

Commit

Permalink
Add trino__equality_fct_multiple_sources_joined test
Browse files Browse the repository at this point in the history
  • Loading branch information
damian3031 committed Sep 7, 2023
1 parent bf1f784 commit b7ab0e4
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 2 deletions.
9 changes: 9 additions & 0 deletions integration_tests/dbt_project_evaluator/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ models:
# Overridden by trino__fct_model_fanout
fct_model_fanout:
+enabled: false
# Overridden by trino__fct_multiple_sources_joined
fct_multiple_sources_joined:
+enabled: false

tests:
dbt_project_evaluator:
Expand All @@ -76,6 +79,9 @@ tests:
# Overridden by trino__equality_fct_model_fanout
equality_fct_model_fanout:
+enabled: false
# Overridden by trino__equality_fct_multiple_sources_joined
equality_fct_multiple_sources_joined:
+enabled: false
structure:
# Overridden by trino__equality_fct_model_naming_conventions
equality_fct_model_naming_conventions:
Expand Down Expand Up @@ -112,6 +118,9 @@ seeds:
# Overridden by trino__test_fct_model_fanout
test_fct_model_fanout:
+enabled: false
# Overridden by trino__test_fct_multiple_sources_joined
test_fct_multiple_sources_joined:
+enabled: false
performance:
# Overridden by trino__test_fct_chained_views_dependencies
test_fct_chained_views_dependencies:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-- this model finds cases where a model references more than one source
with direct_source_relationships as (
select distinct
child,
parent
from {{ ref('int_all_dag_relationships') }}
where distance = 1
and parent_resource_type = 'source'
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 1, 2
),

multiple_sources_joined as (
select
child,
{{ dbt.listagg(
measure='parent',
delimiter_text="', '",
order_by_clause='order by parent')
}} as source_parents
from direct_source_relationships
group by 1
having count(*) > 1
)

select * from multiple_sources_joined

{{ trino__filter_exceptions(model.name) }}
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
version: 2

seeds:
- name: trino__test_fct_multiple_sources_joined
tests:
- dbt_utils.equality:
name: trino__equality_fct_multiple_sources_joined
compare_model: ref('trino__fct_multiple_sources_joined')
compare_columns:
- child
- source_parents

- name: trino__test_fct_duplicate_sources
tests:
- dbt_utils.equality:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
child,source_parents
stg_model_2,"source_1.table_1, source_1.table_2"
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
total_models,documented_models,documentation_coverage_pct,staging_documentation_coverage_pct,intermediate_documentation_coverage_pct,marts_documentation_coverage_pct,other_documentation_coverage_pct
18,3,16.7,20.00,0.00,0.00,66.7
19,3,15.8,20.00,0.00,0.00,66.7
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
total_models,total_tests,tested_models,test_coverage_pct,staging_test_coverage_pct,intermediate_test_coverage_pct,marts_test_coverage_pct,other_test_coverage_pct,test_to_model_ratio
18,11,5,27.8,80.00,50.00,0.00,0.00,0.6
19,11,5,26.3,80.00,50.00,0.00,0.00,0.6
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ trino__fct_model_naming_conventions,resource_name,trino__fct_model_naming_conven
trino__fct_model_naming_conventions,resource_name,trino__fct_duplicate_sources,Trino shim model
trino__fct_model_naming_conventions,resource_name,trino__fct_source_fanout,Trino shim model
trino__fct_model_naming_conventions,resource_name,trino__fct_model_fanout,Trino shim model
trino__fct_model_naming_conventions,resource_name,trino__fct_multiple_sources_joined,Trino shim model
fct_missing_primary_key_tests,resource_name,trino__fct_duplicate_sources,Trino shim model
fct_missing_primary_key_tests,resource_name,trino__fct_model_naming_conventions,Trino shim model
fct_missing_primary_key_tests,resource_name,trino__fct_source_fanout,Trino shim model
fct_missing_primary_key_tests,resource_name,trino__fct_model_fanout,Trino shim model
fct_missing_primary_key_tests,resource_name,trino__fct_multiple_sources_joined,Trino shim model
fct_root_models,child,trino__fct_duplicate_sources,Trino shim model
trino__fct_model_fanout,parent,trino__dbt_project_evaluator_exceptions,Trino shim model
fct_undocumented_models,resource_name,trino__fct_model_naming_conventions,Trino shim model
fct_undocumented_models,resource_name,trino__fct_model_fanout,Trino shim model
fct_undocumented_models,resource_name,trino__fct_duplicate_sources,Trino shim model
fct_undocumented_models,resource_name,trino__fct_source_fanout,Trino shim model
fct_undocumented_models,resource_name,trino__fct_multiple_sources_joined,Trino shim model

0 comments on commit b7ab0e4

Please sign in to comment.