diff --git a/core/dbt/include/global_project/macros/materializations/models/clone.sql b/core/dbt/include/global_project/macros/materializations/models/clone.sql index 6f29d981eb9..8525983619e 100644 --- a/core/dbt/include/global_project/macros/materializations/models/clone.sql +++ b/core/dbt/include/global_project/macros/materializations/models/clone.sql @@ -49,14 +49,22 @@ {%- set relations = {'relations': []} -%} + {%- if not state_relation -%} + -- nothing to do + {{ log("No relation found in state manifest for " ~ model.unique_id) }} + {{ return(relations) }} + {%- endif -%} + {%- set existing_relation = load_cached_relation(this) -%} - {%- set other_existing_relation = load_cached_relation(state_relation) -%} {%- if existing_relation and not flags.FULL_REFRESH -%} -- noop! + {{ log("Relation " ~ existing_relation ~ " already exists") }} {{ return(relations) }} {%- endif -%} + {%- set other_existing_relation = load_cached_relation(state_relation) -%} + -- If this is a database that can do zero-copy cloning of tables, and the other relation is a table, then this will be a table -- Otherwise, this will be a view diff --git a/core/dbt/task/clone.py b/core/dbt/task/clone.py index 2e16b0035c6..cab0d6a2de4 100644 --- a/core/dbt/task/clone.py +++ b/core/dbt/task/clone.py @@ -96,7 +96,7 @@ def execute(self, model, manifest): class CloneTask(GraphRunnableTask): def raise_on_first_error(self): - return True + return False def get_model_schemas(self, adapter, selected_uids: Iterable[str]) -> Set[BaseRelation]: if self.manifest is None: