From the course: Data Engineering: dbt for SQL
Unlock this course with a free trial
Join today to access over 24,200 courses taught by industry experts.
Custom tests in dbt
From the course: Data Engineering: dbt for SQL
Custom tests in dbt
- [Instructor] Let's explore how to create custom tests in dbt. The process is simple and consists of three main steps. First, we'll create a new sql file in the test directory of our dbt project. Then we'll write the custom logic for the custom test in the sql file. Finally, we'll reference this custom test in our dbt model. Let's dive into the details. For our purposes, we're going to recreate the not in all test on the column ID using a custom test. Step one, let's open the example slash model slash example slash schema dot yml file. Next, let's remove the not null test underneath the ID column of the My first dbt model file. As you'll remember, this test has failed in the past. Next, let's run dbt test to ensure that the test successfully run without the null check for the ID column. Great, it looks like this passed. Now let's move to step two. Navigate to the example slash test directory where generic tests are…