Skip to content

Commit

Permalink
Allows a snapshot to have a list as a unique_key
Browse files Browse the repository at this point in the history
  • Loading branch information
AGPapa committed Apr 22, 2024
1 parent 5c8a4ab commit 4a88879
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/dbt/artifacts/resources/v1/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
class SnapshotConfig(NodeConfig):
materialized: str = "snapshot"
strategy: Optional[str] = None
unique_key: Optional[str] = None
target_schema: Optional[str] = None
target_database: Optional[str] = None
updated_at: Optional[str] = None
# Not using Optional because of serialization issues with a Union of str and List[str]
unique_key: Union[str, List[str], None] = None
check_cols: Union[str, List[str], None] = None

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions core/dbt/contracts/graph/model_config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import field, dataclass
from typing import Any, List, Optional, Dict, Type
from typing import Any, List, Optional, Dict, Type, Union

from dbt.artifacts.resources import (
ExposureConfig,
Expand Down Expand Up @@ -42,7 +42,7 @@ class UnitTestNodeConfig(NodeConfig):
@dataclass
class EmptySnapshotConfig(NodeConfig):
materialized: str = "snapshot"
unique_key: Optional[str] = None # override NodeConfig unique_key definition
unique_key: Union[str, List[str], None] = None # override NodeConfig unique_key definition


RESOURCE_TYPES: Dict[NodeType, Type[BaseConfig]] = {
Expand Down

0 comments on commit 4a88879

Please sign in to comment.