Skip to content

Commit

Permalink
check if config has model attr (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
guenp authored Oct 3, 2024
1 parent 51152b3 commit d9da74f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dbt/adapters/duckdb/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d9da74f

Please sign in to comment.