From d9da74fa4703fb79f7f7f7cab52873ba01188d23 Mon Sep 17 00:00:00 2001 From: Guen Prawiroatmodjo Date: Thu, 3 Oct 2024 16:04:02 -0700 Subject: [PATCH] check if config has model attr (#451) --- dbt/adapters/duckdb/impl.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dbt/adapters/duckdb/impl.py b/dbt/adapters/duckdb/impl.py index d4e797ad..89de7873 100644 --- a/dbt/adapters/duckdb/impl.py +++ b/dbt/adapters/duckdb/impl.py @@ -252,7 +252,7 @@ def render_column_constraint(cls, constraint: ColumnLevelConstraint) -> Optional return super().render_column_constraint(constraint) def _clean_up_temp_relation_for_incremental(self, config): - if self.is_motherduck(): + if self.is_motherduck() and hasattr(config, "model"): if "incremental" == config.model.get_materialization(): temp_relation = self.Relation( path=self.get_temp_relation_path(config.model), type=RelationType.Table @@ -264,10 +264,11 @@ def pre_model_hook(self, config: Any) -> None: Cleans up the remote temporary table on MotherDuck before running an incremental model. """ - self._temp_schema_name = config.model.config.meta.get( - TEMP_SCHEMA_NAME, self._temp_schema_name - ) - self._clean_up_temp_relation_for_incremental(config) + if hasattr(config, "model"): + self._temp_schema_name = config.model.config.meta.get( + TEMP_SCHEMA_NAME, self._temp_schema_name + ) + self._clean_up_temp_relation_for_incremental(config) super().pre_model_hook(config) @available