Skip to content

Commit

Permalink
Omit external volume from DDL when not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
dlouseiro committed Jan 29, 2025
1 parent 5d935ee commit 449052a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dbt/adapters/snowflake/relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,11 @@ def get_iceberg_ddl_options(self, config: RelationConfig) -> str:
base_location += f"/{subpath}"

iceberg_ddl_predicates: str = f"""
external_volume = '{config.get('external_volume')}'
catalog = 'snowflake'
base_location = '{base_location}'
"""
if external_volume := config.get("external_volume"):
iceberg_ddl_predicates += f"\nexternal_volume = '{external_volume}'"
return textwrap.indent(textwrap.dedent(iceberg_ddl_predicates), " " * 10)

def __drop_conditions(self, old_relation: "SnowflakeRelation") -> Iterator[Tuple[bool, str]]:
Expand Down
2 changes: 2 additions & 0 deletions dbt/adapters/snowflake/relation_configs/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def from_dict(cls, config_dict: Dict[str, Any]) -> Self:
}
if table_format := config_dict.get("table_format"):
kwargs_dict["table_format"] = TableFormat(table_format)
if external_volume := config_dict.get("external_volume"):
kwargs_dict["external_volume"] = external_volume
return super().from_dict(kwargs_dict)

@classmethod
Expand Down

0 comments on commit 449052a

Please sign in to comment.