Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Beck committed Aug 15, 2018
1 parent b688fcc commit c071588
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions dbt/include/global_project/macros/schema_tests/relationships.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@

{% set column_name = kwargs.get('column_name', kwargs.get('from')) %}


select count(*)
from (
select
model.{{ column_name }} as id
from {{ model }} model
left join {{ to }} target on target.{{ field }} = model.{{ column_name }}
where
model.{{ column_name }} is not null and
target.{{ field }} is null
) validation_errors
select {{ column_name }} as id from {{ model }}
) as child
left join (
select {{ field }} as id from {{ to }}
) as parent on parent.id = child.id
where child.id is not null
and parent.id is null

{% endmacro %}

0 comments on commit c071588

Please sign in to comment.