Knowledge check

dbt run executes your models, but dbt build does more: it runs your models and your dbt tests in the correct order, failing early if a test fails. Using dbt build is the recommended default because it gives you data quality checks alongside execution at no extra cost.

  1. Open the defs/assets/dbt.py file.

  2. Modify dbt_analytics to run dbt build instead of dbt run. The function should look like this afterward:

    # src/dagster_and_dbt/defs/assets/dbt.py
    @dbt_assets(
        manifest=dbt_project.manifest_path
    )
    def dbt_analytics(context: dg.AssetExecutionContext, dbt: DbtCliResource):
        yield from dbt.cli(["build"], context=context).stream()
    
  3. In the Dagster UI, re-materialize both of the dbt models.

  4. Navigate to the details page for the run you just started, then look at the logs.

When finished, proceed to the next page.