mirror of
https://github.com/dbt-labs/dbt-project-evaluator.git
synced 2025-12-18 02:11:27 +00:00
Co-authored-by: Grace Goheen <53586774+graciegoheen@users.noreply.github.com> Co-authored-by: Benoit Perigaud <8754100+b-per@users.noreply.github.com>
23 lines
539 B
SQL
23 lines
539 B
SQL
with all_dag_relationships as (
|
|
select
|
|
*
|
|
from {{ ref('int_all_dag_relationships') }}
|
|
where not child_is_excluded
|
|
and child_resource_type = 'model'
|
|
),
|
|
|
|
final as (
|
|
select
|
|
child as resource_name,
|
|
child_file_path as file_path,
|
|
cast(count(distinct parent) as {{ dbt.type_int() }}) as join_count
|
|
from all_dag_relationships
|
|
where distance = 1
|
|
group by 1, 2
|
|
having count(distinct parent) >= {{ var('too_many_joins_threshold') }}
|
|
)
|
|
|
|
select * from final
|
|
|
|
{{ filter_exceptions() }}
|