Skip to content

Commit 676c66c

Browse files
authored
Remove catalog from RelationConfig protocol and target_relation in Snowflake incremental materialization (#1376)
1 parent 65bc944 commit 676c66c

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Under the Hood
2+
body: Remove `catalog` from `RelationConfig` protocol and update base build_catalog_relation to obtain catalog_name from node config
3+
time: 2025-10-08T16:22:09.164799-04:00
4+
custom:
5+
Author: michelleark
6+
Issue: "1376"

dbt-adapters/src/dbt/adapters/base/impl.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
CatalogIntegrationClient,
8080
CatalogIntegrationConfig,
8181
CatalogRelation,
82+
CATALOG_INTEGRATION_MODEL_CONFIG_NAME,
8283
)
8384
from dbt.adapters.contracts.connection import Credentials
8485
from dbt.adapters.contracts.macros import MacroResolverProtocol
@@ -335,9 +336,18 @@ def get_catalog_integration(self, name: str) -> CatalogIntegration:
335336
return self._catalog_client.get(name)
336337

337338
@available
338-
def build_catalog_relation(self, config: RelationConfig) -> CatalogRelation:
339-
catalog = self.get_catalog_integration(config.catalog)
340-
return catalog.build_relation(config)
339+
def build_catalog_relation(self, config: RelationConfig) -> Optional[CatalogRelation]:
340+
if not config.config:
341+
return None
342+
343+
# "catalog" is legacy, but we support it for backward compatibility
344+
if catalog_name := config.config.get(
345+
CATALOG_INTEGRATION_MODEL_CONFIG_NAME
346+
) or config.config.get("catalog"):
347+
catalog = self.get_catalog_integration(catalog_name)
348+
return catalog.build_relation(config)
349+
350+
return None
341351

342352
###
343353
# Methods to set / access a macro resolver

dbt-adapters/src/dbt/adapters/contracts/relation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ class RelationConfig(Protocol):
6060
tags: List[str]
6161
quoting_dict: Dict[str, bool]
6262
config: Optional[MaterializationConfig]
63-
catalog: Optional[str]
6463

6564

6665
class ComponentName(StrEnum):
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Features
2+
body: Remove catalog from target_relation in incremental macro
3+
time: 2025-10-08T16:23:21.153185-04:00
4+
custom:
5+
Author: michelleark
6+
Issue: "1376"

dbt-snowflake/src/dbt/include/snowflake/macros/materializations/incremental.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
database=database,
8383
type='table',
8484
table_format=catalog_relation.table_format,
85-
catalog=config.model.catalog,
8685
) -%}
8786

8887
{% set existing_relation = load_relation(this) %}

0 commit comments

Comments
 (0)