[Bug] Restore v1.7 behavior for `--defer` + `--favor-state` when selecting interdependent resources
jtcohen6 opened this issue · comments
Is this a new bug in dbt-core?
- I believe this is a new bug in dbt-core
- I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
Given:
model_a ----\
\
--> model_c
/
model_b ----/
After the recent refactors to deferral, dbt run --select model_b model_c --favor-state
would yield compiled code such that:
-- target/compiled/model_c.sql
select * from prod.model_a
union all
select * from prod.model_b
Expected Behavior
In v1.7 and previous versions, because model_b
is also selected in the current run (even though we are using --favor-state
overall), the compiled code for model_c
should use the prod target for model_a
(regardless of whether it exists in the dev schema) but always the dev target for model_b
:
-- target/compiled/model_c.sql
select * from prod.model_a
union all
select * from dev.model_b
Steps To Reproduce
- Define
model_a
,model_b
,model_c
as shown dbt run --target prod
mv target/manifest.json state/
dbt run --select model_b model_c --favor-state
Relevant log output
No response
Environment
dbt: 1.8.0rc1 / main
Which database adapter are you using with dbt?
No response
Additional Context
This has not been reported by any users/customers, I just realized it while writing this comment: