Learning Objectives
By the end of this chapter, you will be able to:
- Declare dbt exposures with the correct
type,owner,maturity,url, anddepends_onkeys, and reason about how the exposure appears indbt docsand how it participates in selector expressions such as+exposure:name. - Configure
source freshnessthresholds against aloaded_at_field, includingwarn_afteranderror_afterwithcountandperiod, thefilterargument, theloaded_at_queryoverride, and the source-level versus table-level cascade. - Run
dbt source freshnessagainst single sources, full source families, and selector expressions, and read the resultingsources.jsonartifact to triage stale data. - Manage package dependencies in
packages.ymlusing hub, git, and local install methods, pin versions through SemVer ranges, install withdbt deps, and reason about lock files, transitive dependencies, and adapter compatibility.
Executive Summary
- Exposures sit at the tail of the DAG and declare the downstream artifact (dashboard, application, ML feature store, notebook) that consumes one or more dbt models, sources, or metrics, giving graph operators such as
+exposure:tableau_revenue_dashboarda way to build only what feeds a specific consumer. - Source freshness pushes the SLA enforcement back to the loader by checking the maximum
loaded_at_fieldvalue againstwarn_afteranderror_afterthresholds, surfacing late-arriving data before a downstream model silently runs on stale rows. - Package dependencies declared in
packages.ymlinstall intodbt_packages/and merge into the project graph at parse time, which means a package model is treated as a first-class dbt node with its own materialization, tests, and lineage. - The three surfaces share a single pattern: a YAML declaration, a CLI activation step, and a JSON artifact under
target/that records the result, and the exam tests how those three artifacts compose against the broader build workflow described in earlier chapters.
Assumptions
- The reader has authored sources, models, and tests as covered in earlier chapters and is comfortable with
ref(),source(),dbt build,state:modified+, and slim CI mechanics. - All code examples target a current stable dbt version (1.8 or later) where
data_tests:is the canonical key and the source freshness block is configured undersources:in YAML rather than the deprecated top-levelfreshness:shorthand. - Warehouse-specific behavior is called out explicitly where Snowflake, BigQuery, Databricks, Redshift, and Postgres diverge; otherwise examples are warehouse-neutral.
- Package examples use real package names from
hub.getdbt.com(dbt_utils,dbt_expectations,dbt_codegen,audit_helper) without asserting specific package version numbers, since SemVer ranges drift across releases.
