-
Notifications
You must be signed in to change notification settings - Fork 286
Description
Problem
dbt clone fails when the source table is a Snowflake Iceberg table. Snowflake requires CREATE ICEBERG TABLE ... CLONE ... syntax for Iceberg tables, but the Snowflake adapter's snowflake__create_or_replace_clone macro always generates CREATE [TRANSIENT] TABLE ... CLONE ....
Expected behavior
dbt clone should automatically detect whether the source relation is an Iceberg table and use the correct DDL syntax, without requiring any additional user configuration.
Proposed fix
The Snowflake adapter already tracks Iceberg status via SnowflakeRelation.is_iceberg_format (populated from Snowflake's SHOW OBJECTS metadata). The fix is to look up the source relation in the cache inside the clone macro and conditionally emit the ICEBERG keyword:
- Source is Iceberg →
CREATE OR REPLACE ICEBERG TABLE ... CLONE ... - Source is not Iceberg →
CREATE OR REPLACE [TRANSIENT] TABLE ... CLONE ...(existing behavior)
The transient keyword is also correctly omitted for Iceberg clones since Iceberg tables cannot be transient.