hands-on lab
Defining and Working With dbt Tests
Difficulty: Advanced
Duration: Up to 1 hour and 15 minutes
Students: 148
Rating: 5/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.
Description
When working with data, you want to be sure that specific requirements and standards are satisfied by your data. When transforming and modeling the data, having a tool that automatically tests the output data could be a good solution in order to have high-quality data.
Testing is a core component when working with data, so dbt allows you to test your sources and models. You can use native dbt tests, but you can also define your own.
In this lab step, you will test your dbt sources. You will then create a custom test, and test a model both with native and custom dbt tests.
Learning Objectives
Upon completion of this lab, you will be able to:
- Understand what tests are and how to work with tests
- Create custom dbt tests
Intended Audience
- Data analysts that need to test the dbt output produced
- Developers that need to create custom dbt tests
Prerequisites
To get the most from this lab, you should have basic knowledge of dbt. To get ready, you can use the following labs:
- Create Your First dbt (Data Build Tool) Project
- Configure a dbt Profile and Define Sources
- Create and Execute Your First dbt Models
- Working With Full-Refresh dbt Models
- Working With Incremental dbt Models
- Working With Ephemeral dbt Models
- Understand and Use dbt Jinja Macros
- Understand and Work With dbt Seeds
Covered topics
Lab steps
Understanding dbt Tests
Connecting to the dbt Web IDE
Defining dbt Tests on Sources
Creating a Custom dbt Test
Adding dbt Tests to Models
Performing dbt Tests and Executing the Models