Skip to main content

Impact Analysis using Exposures

Defining Exposures in YAML creates beautiful documentation in the dbt Docs UI. However, the real power of Exposures is using them in the Command Line Interface (CLI) to perform Impact Analysis.

Impact Analysis answers the question: "If I change this specific model, what will break downstream?"

Or conversely: "This dashboard is broken. How do I run only the models that feed this specific dashboard to fix it?"

Topics Covered​

  • Node Selection using Exposures
  • Upstream Tracing (Building a Dashboard)
  • Downstream Tracing (Impact Analysis)
  • CI/CD Integration

1. Node Selection using Exposures​

Just like you can select models using tags (--select tag:hourly), you can select nodes based on exposures using the exposure: selector in the dbt CLI.

Assume we have an exposure defined in YAML named finance_monthly_dashboard.

The + Operator​

The + operator in dbt means "dependencies".

  • +model_name means "the model and all its parents".
  • model_name+ means "the model and all its children".

2. Upstream Tracing (Building a Dashboard)​

Suppose the VP of Finance in Delhi opens Tableau on a Monday morning and the finance_monthly_dashboard is completely blank. The nightly batch job must have failed.

You need to rebuild the data for that dashboard immediately. But you don't want to run dbt build, because that will rebuild 1,000 models and take 2 hours.

You can use the exposure selector to build only the models that feed that specific dashboard!

# The '+' is placed BEFORE the exposure name.
# This means: "Run all upstream parents of this exposure"

dbt build --select +exposure:finance_monthly_dashboard

dbt will look at the depends_on list in your exposures.yml, find the parent models (e.g., fct_monthly_revenue), trace their lineage all the way back to the raw source tables, and execute exactly that slice of the DAG. The dashboard is fixed in 5 minutes.

3. Downstream Tracing (Proactive Impact Analysis)​

Suppose a Data Engineer (Arjun) is assigned a Jira ticket to refactor the stg_stripe_payments model. He wants to delete the currency_code column because it is always "INR".

Before he deletes it, he needs to know: "If I break stg_stripe_payments, which external dashboards will be affected?"

He can use the dbt ls (list) command combined with the downstream operator.

# The '+' is placed AFTER the model name.
# This means: "List all children of this model, filtered to only show exposures"

dbt ls --select stg_stripe_payments+ --resource-type exposure

Output:

exposure:beems_retail.finance_monthly_dashboard
exposure:beems_retail.daily_sales_tracker

Arjun immediately knows that deleting this column might break two specific dashboards. He can look up the owner of those exposures in the dbt Docs and email them before making the change.

4. CI/CD Integration for Impact Analysis​

Modern data teams automate this impact analysis using Slim CI (which we covered in previous modules).

When Arjun opens a Pull Request on GitHub to delete the column, GitHub Actions runs this command:

dbt build --select state:modified+ --state ./prod-run-artifacts/

This tells dbt: "Find the modified model (stg_stripe_payments), run it, and run ALL of its downstream children."

If any downstream model (like fct_monthly_revenue) tries to SELECT currency_code, the model will fail to compile. The CI pipeline will fail, throwing a bright red "X" on Arjun's Pull Request, physically preventing him from merging the code that would have broken the finance_monthly_dashboard exposure.

Summary​

  • You can query exposures in the CLI using the exposure:exposure_name selector.
  • Use +exposure:name to run all upstream models required to power a specific dashboard.
  • Use dbt ls --select model_name+ --resource-type exposure to perform manual impact analysis and find out who relies on a specific table.
  • Rely on automated Slim CI (state:modified+) to proactively catch breaking changes before they reach production.