📘Introduction

In this hands-on dbt tutorial, you’ll learn how to configure your sources.yml file to handle multiple environments (DEV and PROD) dynamically using dbt’s powerful target variable. This will ensure that your models always connect to the correct database, based on the environment you are currently working in, without needing any manual changes.

🎓 Preparing for dbt Analytics Engineering Certification?
Check out our exam study guide packed with practical examples and hands-on tutorials:

➡️📕 dbt Analytics Engineering Certification Guide

↔️ DEV and PROD environments in dbt

Before we dive in, have a look at our previous post:

Configuring DEV an PROD Environments in dbt
📘Introduction In this hands-on dbt tutorial, you’ll learn how to configure separate development (DEV) and production (PROD) environments to safely build, test, and deploy your data models. We’ll walk through why environment separation matters and how to configure your profiles.yml so you can switch between environments with

In that tutorial, you learned how to configure separate DEV and PROD environments in dbt.

Now, we’ll take it a step further by showing how to use dbt’s built-in target variable to make your sources.yml dynamically switch between DEV and PROD without changing any code.

⚙️ Target variable in our example project

Here’s the profiles.yml for our example project dlnerds_university:

You can view this post with the tier: Academy Membership

Join academy now to read the post and get access to the full library of premium posts for academy members only.

Join Academy Already have an account? Sign In