0
0
dbtdata~30 mins

Why governance ensures data trust in dbt - See It in Action

Choose your learning style9 modes available
Why governance ensures data trust
📖 Scenario: Imagine you work in a company where many teams use data to make decisions. Sometimes, the data is confusing or wrong, and people don't trust it. To fix this, the company wants to organize how data is handled and checked. This is called data governance.
🎯 Goal: You will create a simple dbt project that shows how data governance helps keep data clean and trusted. You will set up a data source, add a rule to check data quality, and then see the results that prove the data is trustworthy.
📋 What You'll Learn
Create a source configuration for a sales table
Add a test to check that sales amounts are never negative
Write a dbt model that selects only valid sales
Run the model and show the filtered results
💡 Why This Matters
🌍 Real World
Companies use data governance to make sure data is accurate and reliable before teams use it for decisions.
💼 Career
Data analysts and engineers use dbt to build trusted data pipelines that enforce governance rules and improve data trust.
Progress0 / 4 steps
1
Set up the sales data source
Create a source configuration in sources.yml for a table called sales in the raw schema. The source name should be raw_data. Include the table name and schema exactly as given.
dbt
Need a hint?

Use the sources key with a list containing a source named raw_data. Inside it, set schema to raw and add a table named sales.

2
Add a test to check sales amounts
In the same sources.yml file, add a test under the sales table to ensure the column amount is never negative. Use the built-in dbt test not_null and a custom test for amount >= 0.
dbt
Need a hint?

Under the sales table, add a columns list. For the amount column, add not_null and a test with expression: amount >= 0.

3
Create a model to select valid sales
Create a dbt model file called valid_sales.sql. Write a SQL query that selects all columns from the source raw_data.sales where amount is greater than or equal to zero.
dbt
Need a hint?

Use the source function with 'raw_data' and 'sales'. Add a where clause to keep rows with amount >= 0.

4
Run the model and show the results
Run the dbt model valid_sales and print the resulting rows. Use print() to display the output of the model query.
dbt
Need a hint?

Print the column headers and example rows that show only sales with non-negative amounts.