Model with multiple parents gets dropped

The problem I’m having

In my dbt-Redshift project, I have a model M with two parents, A and B.
Due to an unexpected upstream issue, my production dbt Run saw the run of A succeed, but the run of B failed. Because B failed, the subsequent run of M was skipped, as expected. What I did not expect was that M would go missing from my production Redshift schema!

It seems that the success of A dropped the M table due to Redshift’s schema binding, while the failure of B prevented dbt from recreating M. Ideally, a failure of either parent would induce a rollback of the dropping of M, but I’m not sure dbt’s current transactional system supports this.

Has anyone encountered this before, or have any tips on how to manage this scenario?

I’ve encountered the same behavior in Postgres. In my setup, A and B are tables and M is a view. When running dbt build, if B fails, dbt skips building M as expected — but M still gets dropped in the database. After the run, B remains, but M has disappeared.

What’s interesting is that this only happens when M depends on both A and B. If I modify the model so that M depends only on B, then a failure in B does not cause M to be dropped.

The original post is old, but I’m curious: has anyone discovered a reliable solution or workaround for this behavior?