-
Notifications
You must be signed in to change notification settings - Fork 178
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] Drop temp tables when doing a full refresh on Dynamic table by respecting qualified names #1103
Comments
We also met the same issue that the command |
Exactly, when it should be |
Hi Folks - I'm trying to get a better understanding of this issue. @sfc-gh-dfrail , @Evelyn-yx-Li @srinivasreddie It seems like there might be multiple concerns at hand. Could you confirm that I'm reading this correctly? @srinivasreddie It seems like when you are trying to do a full-refresh on your dynamic table, it's not dropping your temp tables related to your dynamic table? Would you be able to provide a clean log so we can see what you see? Also what is the dbt-snowflake adapter version you're operating on. @Evelyn-yx-Li it seems like your concern is unrelated to DTs specifically and might have been fixed by this #1031? @sfc-gh-dfrail per your last response on the other issue, are you still experiencing this issue? If so, can you provide clear instructions on how to reproduce this? |
@amychen1776 I was about to open a bug but found this one which seems related. I encounter a bug in dbt-snowflake around using dynamic tables with non-standard quoting policy. I use the following configs: dbt_project.yml:
profiles.yml:
model file (from the dbt init project):
Running
The actual SQL seen in Snowflake query history is:
Which indeed shows that the schema remains unquoted. As far as I can tell, this command comes from Please let me know if more information is required. |
Same issue when trying to replace a transient table with a dynamic table. While renaming the existing object the name is not fully qualified, so it fails at that step because there's no active Executed SQLdrop table if exists "DEV__SOMEDB"."SOMESCHEMA"."MODEL_NAME__dbt_backup" cascade;
alter table "DEV__SOMEDB"."SOMESCHEMA"."MODEL_NAME" rename to MODEL_NAME__dbt_backup; --<--------
create dynamic table dev__somedb.someschema.model_name
target_lag = '30 minutes'
warehouse = SOME_WH
as (
...
) Error returned when executing
WorkaroundThis works because the unqualified backup table creation SQL is never generated in the first place.
Fix?I believe the issue is somewhere around here. It doesn't appear that the backup_relation.render() function is fully qualifying the backup relation's name when generating the alter sql using the |
Is this a new bug in dbt-snowflake?
Current Behavior
While trying to do full refresh or recreate on dynamic table we are getting issue.
while droping it using double quotes with DB and Schema as "DB"."SCHEMA"."model__dbt_backup"
where as while alter table rename to backup its not using DB and schema (defaulted to profiles.yml schema not considering schema from model file). Also no double quotes (so snowflake creating as upper case and model__DBT_BACKUP) which causing issue when we do full refresh
Expected Behavior
I'm expecting to take schema and DB from model file in sql we have config also add double quotes when performing alter table rename to backup so drop and alter will be in sync
Steps To Reproduce
{{
config(
materialized='dynamic_table',
target_lag='30 minutes',
schema='fake_schema'
)
}}
select
Once you run this model in snowflake please do full refresh again to capture statements it will populate the queries
Relevant log output
No response
Environment
Additional Context
Adding @[email protected]
The text was updated successfully, but these errors were encountered: