0
0
dbtdata~15 mins

Configuring sources in YAML in dbt - Try It Yourself

Choose your learning style9 modes available
Configuring sources in YAML
📖 Scenario: You are working on a data project using dbt. You want to tell dbt where your raw data lives by configuring sources in a YAML file. This helps dbt understand your data tables before you transform them.
🎯 Goal: Learn how to write a YAML configuration for a source in dbt. You will create a source with a name, specify the database and schema, and list the tables inside it.
📋 What You'll Learn
Create a YAML file with a source configuration
Define a source named raw_data
Set the database to analytics_db
Set the schema to public
Add a table named customers with a description
Add a table named orders with a description
💡 Why This Matters
🌍 Real World
In real data projects, configuring sources in YAML helps document and manage raw data tables before transforming them.
💼 Career
Data engineers and analysts use source configurations in dbt to build reliable and maintainable data pipelines.
Progress0 / 4 steps
1
Create the basic source structure
Create a YAML file and write a source configuration with the name raw_data. Set the database to analytics_db and the schema to public. Do not add any tables yet.
dbt
Need a hint?

Start with sources: then add a list item with name, database, and schema.

2
Add the first table to the source
Add a table named customers inside the tables list of the raw_data source. Add a description: Customer details table.
dbt
Need a hint?

Inside tables:, add a list item with name: customers and description.

3
Add the second table to the source
Add another table named orders inside the tables list of the raw_data source. Add a description: Orders placed by customers.
dbt
Need a hint?

Add a second list item under tables: with the orders table and its description.

4
Display the complete YAML source configuration
Print the complete YAML source configuration for raw_data with both tables customers and orders and their descriptions.
dbt
Need a hint?

Print the YAML text exactly as configured in previous steps.