-
Notifications
You must be signed in to change notification settings - Fork 175
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
[Bug] _dbt_backup suffixed tables don't drop for dynamic tables #1047
Comments
@j-choe Thanks for opening! I have a feeling this could be the same as: |
I have recently been affected by this - yes, it is to do with the rename macro. Generated code looks like Note the rename doesn't name the database and schema of the target, while naming it when attempting the drop.
dbt-adapters\dbt\include\global_project\macros\relations\create_backup.sql passes the full current relation, but only the identifier for the backup relation to the renamer - i don't know if this is significant (ie, does "identifier" include the database and schema? )
|
@AartBluestoke Good catch. We could either:
|
I would suggest the first. |
@jtcohen6 - #1016 is substantially contributing to this bug
note: no preamble to backup the old version. |
@AartBluestoke We're aware that the Snowflake behavior change described in #1016 is the underlying issue (while this bug was the confounding issue that actually raised the error for users). You can see our next steps for resolving that bug directly:
I think we may need to support a type signature of |
Closing as: |
Is this a new bug in dbt-core?
Current Behavior
When creating tables, dbt does the following:
When a model utilizes
dynamic_table
as the materialization, it will create the dynamic table as normal, but does not drop the_dbt_backup
suffixed table. Looking into dbt debug logs:drop table if exists "DATABASE"."PUBLIC"."DYNAMIC_TABLE_NAME__dbt_backup" cascade
It seems like dbt is trying to drop a table instead of the renamed dynamic table. Consequently, when utilizing
dbt build
ordbt run
, I'm left with 2 dynamic tables calleddynamic_table_name
anddynamic_table_name__dbt_backup
Expected Behavior
When running a command, I expect the
_dbt_backup
suffixed table to be dropped.Steps To Reproduce
dbt build --select test_dynamic_table
dbt build --select test_dynamic_table --full-refresh
Relevant log output
No response
Environment
Which database adapter are you using with dbt?
snowflake
Additional Context
No response
The text was updated successfully, but these errors were encountered: