dbt-labs / dbt-core

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
https://getdbt.com
Apache License 2.0
9.25k stars 1.53k forks source link

[Bug] --select state:modified does not pick up changes to node `depends_on` values #10343

Open MichelleArk opened 1 week ago

MichelleArk commented 1 week ago

Is this a new bug in dbt-core?

Current Behavior

Given a model with environment-based dependencies:

select 1 as id

{% if target.name == "prod" %}
    -- depends_on : {{ ref('data_change_model') }}
{% else %}
    -- depends_on : {{ ref('column_added_model') }}
{% endif %}select 1 as id

{% if target.name == "prod" %}
    -- depends_on : {{ ref('data_change_model') }}
{% else %}
    -- depends_on : {{ ref('column_added_model') }}
{% endif %}

given a prod (deferred) and dev manifest, dbt does not pick this up as a modified node in state:modified because it does not consider the node's depends_on (most often this is proxied by the node body contents)

Expected Behavior

dbt picks up the modified model between prod & dev runs as the depends_on have changed

Steps To Reproduce

  1. dbt run --target prod
  2. cp target/manifest state
  3. dbt ls --select state:modified --state state

Relevant log output

No response

Environment

- OS:
- Python:
- dbt:

Which database adapter are you using with dbt?

other (mention it in "Additional Context")

Additional Context

No response