Closed AartBluestoke closed 6 months ago
could this be another example of https://github.com/dbt-labs/dbt-snowflake/issues/1016 ? - which required an updated 'is_dynamic' table check - the current table code only has the outer check?
{% if existing_relation.is_table %}
{% set is_dynamic_table = (snowflake__describe_dynamic_table(existing_relation).dynamic_table.rows | length > 0) %}
{% if is_dynamic_table %}
{% set existing_relation = existing_relation.incorporate(type=this.DynamicTable) %}
{% endif %}
{% endif %}
@AartBluestoke Thanks! I'm going to close this as a duplicate of these issues, addressing the same concern:
Is this a new bug in dbt-snowflake?
Current Behavior
dynamic tables are tables causing the following check to fail:
doesn't drop then issues the standard
create or replace table as ...
This prints the messageKeeping relation "DEV_mydatabase"."raw"."mytable" because it is of type table
then fails withSQL compilation error: Object 'mytable' already exists as DYNAMIC_TABLE
Expected Behavior
because snowflake considers table and dynamic table to be different object types (as per the error message, grant allocations, and assorted other different capabilities) that "is table" would be 'false' for a dynamic table.
Steps To Reproduce
create dynamic test_table as select 1
Relevant log output
No response
Environment
Additional Context
although the above fragment is my code, dbt-snowflake has the same check: https://github.com/dbt-labs/dbt-snowflake/blob/87a6e808dfb025df1eeef3741ad3822635249889/dbt/include/snowflake/macros/materializations/table.sql#L19