Skip to content

Commit

Permalink
fix logical error in conflicting_values
Browse files Browse the repository at this point in the history
  • Loading branch information
leoebfolsom committed Mar 27, 2023
1 parent 1e76ed9 commit 49d3479
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions macros/compare_column_values_verbose.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ b_query as (
b_query.{{ column_to_compare }} is null and b_query.{{ primary_key }} is not null as null_in_b,
a_query.{{ primary_key }} is null as missing_from_a,
b_query.{{ primary_key }} is null as missing_from_b,
coalesce(a_query.{{ column_to_compare }} != b_query.{{ column_to_compare }} and
(a_query.{{ column_to_compare }} is not null or b_query.{{ column_to_compare }} is not null), false)
as conflicting_values
-- considered a conflict if the values do not match AND at least one of the values is not null.
coalesce(
a_query.{{ column_to_compare }} != b_query.{{ column_to_compare }} or
(a_query.{{ column_to_compare }} is not null and b_query.{{ column_to_compare }} is null) or
(a_query.{{ column_to_compare }} is null and b_query.{{ column_to_compare }} is not null),
false
) as conflicting_values
-- considered a conflict if the values do not match AND at least one of the values is not null.

from a_query

Expand Down

0 comments on commit 49d3479

Please sign in to comment.