0
0
dbtdata~3 mins

Configuring sources in YAML in dbt - Why You Should Know This

Choose your learning style9 modes available
The Big Idea

What if you could fix all your data source errors by changing just one simple file?

The Scenario

Imagine you have many data tables from different places, and you need to tell your project where each table lives by writing long lists of details in many places.

The Problem

Manually tracking each data source in code is slow and confusing. You might forget to update a table name or location, causing errors that are hard to find.

The Solution

Using YAML to configure sources lets you keep all source details in one clear, simple file. This makes it easy to update and reuse source info without mistakes.

Before vs After
Before
SELECT * FROM database.schema.table_name;
-- Hard to track and update source details scattered in SQL
After
sources:
  - name: my_source
    tables:
      - name: table_name

-- Reference source in models with {{ source('my_source', 'table_name') }}
What It Enables

It enables clean, centralized source management that makes your data projects easier to maintain and less error-prone.

Real Life Example

A data analyst working on sales reports can update the source location in one YAML file, and all reports automatically use the new data without changing each SQL query.

Key Takeaways

Manual source tracking is slow and error-prone.

YAML centralizes source info in one place.

This makes data projects easier to update and maintain.