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 that order_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 of order_id in the orders model.

  • In schema.yml, add descriptions to the stocks model.

  • Edit profiles.yml so that when models are run with the dev target, they’re created in a dataset called educative_orders_dev.

  • Edit profiles.yml to add a target named prod. The default dataset for this target should be named educative_orders.

Try it out

Add the solution in the playground given below.

Get hands-on with 1400+ tech skills courses.