dbt-labs / dbt-labs/docs.getdbt.com

Defer use example wrong?

Open
#5,280 0 comments 0 reactions 1 assignee Assigned to @luna-bianca View on GitHub
community content improvement
Dominant language
JavaScript
Stars
215
Forks
1.2k
Avg merge
1d 15h
Merged PRs (30d)
130

Description

### Contributions

- [X] I have read the contribution docs, and understand what's expected of me.

### Link to the page on docs.getdbt.com requiring updates

https://docs.getdbt.com/reference/node-selection/defer#test

### What part(s) of the page would you like to see updated?

Hi. At the bottom of the previous link, the one beginning with this string:
"_(A bit silly, since all the data in model_b had to come from model_a, but suspend your disbelief.)_"
, there's an example of a test with and without the --defer flag, that's two examples that I think are wrong. Since the alleged error is the same for both of them, I'll talk about just one, the one with the flag because it would be the one with the code working as it should. The code is this:
`select count(*) as validation_errors
from (
select id as id from dev_alice.model_b
) as child
left join (
select id as id from prod.model_a
) as parent on parent.id = child.id
where child.id is not null
and parent.id is null`
According to the text, this query succeeds and I guess, it means that it doesn't break but it's purpose as a test, for me, is wrong because it's impossible that the LEFT JOIN would work, since it demans that all the values fitting the JOIN, should fulfill this condition:
`NULL = NOT NULL`
, in other words, since the result of the query would be ZERO rows, the test it will always be right!!!
As an example it seems rather poor. It might be more illustrating if the condition was that child.count(*) > Number (to determine).
Regards.
IL.

### Additional information

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.