dbt Macro Changes Not Triggering AutomationCondition.code_version_changed()

Last updated: November 6, 2025

Problem Description

  When using AutomationCondition.code_version_changed() with dbt assets, changes to dbt macros do not trigger asset materialization even though the macro changes affect the dbt models. This results in assets not being automatically updated when their underlying macro dependencies change.

Symptoms

  • dbt assets do not automatically materialize after deploying code changes that modify dbt macros

  • AutomationCondition.code_version_changed() does not detect macro modifications as code changes

  • Assets remain unmaterialized despite having dependencies on the changed macros

Root Cause

  The code version for dbt assets is calculated based on the raw_code or raw_sql from the dbt manifest.json. However, macros and ephemeral models aren't imported into Dagster's asset graph, so their code isn't included in the code version calculation. When you change a macro that a dbt model depends on, the model's code version won't change, and automation conditions won't detect it as stale.

Solution

  Manually trigger materialization of affected assets after deploying macro changes until a permanent solution is implemented.

Step-by-Step Resolution

  1. Identify which dbt models are affected by your macro changes

  2. After deploying code changes that include macro modifications, manually trigger materialization of the affected assets through the Dagster UI or programmatically

  3. Monitor the GitHub issue at https://github.com/dagster-io/dagster/issues/22566 for updates on when this limitation will be addressed

Alternative Solutions (if applicable)

  Consider implementing custom automation conditions that track macro file modifications or use time-based triggers as a workaround until the core issue is resolved.

Prevention

  Be aware of this limitation when designing automation workflows that depend on macro changes. Plan for manual intervention or alternative triggering mechanisms when macro modifications are part of your deployment process.

Related Documentation