Challenge: Targets, Tests, and Documentation
Complete this hands-on exercise to execute your models in different environments and test and document your data.
We'll cover the following
Problem statement
The dbt project from your shop has two models: orders
and stocks
. Recently, you’ve noticed some issues:
The
orders
model sometimes contains duplicates. You want a way to check thatorder_id
is unique.Stakeholders can’t easily understand the
stocks
model. Documenting the model might help them understand it.You’ve made mistakes directly on the main project. You want a way to test your changes in a development environment before pushing them to prod.
Tasks
In
schema.yml
, create a test that checks the unicity oforder_id
in theorders
model.In
schema.yml
, add descriptions to thestocks
model.Edit
profiles.yml
so that when models are run with thedev
target, they’re created in a dataset callededucative_orders_dev
.Edit
profiles.yml
to add a target namedprod
. The default dataset for this target should be namededucative_orders
.
Try it out
Add the solution in the playground given below.
Get hands-on with 1400+ tech skills courses.