Search⌘ K
AI Features

Setting Up and Referencing a Source

Explore how to create and manage data sources in dbt by defining sources in YAML files and referencing them using the source function. Understand the importance of avoiding hard-coded table names, learn to list source tables via CLI, and see practical examples to build reliable and maintainable data pipelines.

Introduction to sources

The ref function allows us to query another dbt model. But very often, we need to query some sources that were not created through dbt. We can reference them by typing their full name(s):

MySQL
SELECT *
FROM marketing_dataset.raw_ads

But it’s not a good practice because that table might change location and ...