From the course: Data Engineering: dbt for SQL

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Solution: Testing SQL

Solution: Testing SQL

(upbeat music) - [Instructor] Congratulations on completing the testing challenge. Let's run through our solution. As always, there are likely multiple correct answers. Depending on the assumptions that you make during the challenge, I will show you a potential solution. Let's open up chapter5/models/schema.yaml. The first part of the task involved using some of DBTs built-in tests on the columns. Let's quickly run through them. In the case of adid the description mentions that each row has a distinct value and that the value is required. As such, let's apply the unique and not null tests to this column. The latitude, longitude city and event date columns are all required but nothing specifies that the values must be unique or that another built-in test may apply. For that reason, we'll simply add the not null test. Looking at cohort we can see that the cohort field is required and that there are actually a set of…

Contents