Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop queries for full-refresh builds are not namespaced on pg/redshift #1933

Closed
drewbanin opened this issue Nov 18, 2019 · 1 comment
Closed
Labels
bug Something isn't working redshift

Comments

@drewbanin
Copy link
Contributor

Describe the bug

When dbt replaces a view or table in an incremental build, it creates a backup_relation. This relation is intended to be dropped at the end of model build. Errantly, dbt created this backup_relation without a schema on postgres and redshift. This results in a (correct) rename query which looks like:

alter table schema.table rename to table__dbt_backup_20191118

but the corresponding drop at the end of the builds looks like:

drop table if exists table__dbt_backup_20191118

This second query is incorrect, as it this query is looking for a table called table__dbt_backup_20191118 in the public schema! As a result, full refresh builds on postgres + redshift may have been leaving backup tables in dbt schemas since at least 0.14.3, though possibly earlier.

Steps To Reproduce

Using 0.14.x, create an incremental model and run it with the --full-refresh flag a couple of times. You should see lingering backup tables in the dbt schema.

System information

Which database are you using dbt with?

  • postgres
  • redshift
@drewbanin drewbanin added this to the Louisa May Alcott milestone Nov 18, 2019
@drewbanin drewbanin added the bug Something isn't working label Nov 18, 2019
@drewbanin
Copy link
Contributor Author

this was fixed in #1931

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working redshift
Projects
None yet
Development

No branches or pull requests

1 participant