Skip to content

Commit

Permalink
fill out changeset and config change classes for specific options
Browse files Browse the repository at this point in the history
  • Loading branch information
McKnight-42 committed Sep 14, 2023
1 parent 52f5dfd commit eb34007
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions dbt/adapters/bigquery/relation_configs/materialized_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import agate
from dbt.exceptions import DbtRuntimeError
from dbt.adapters.relation_configs.config_change import RelationConfigChange
from dbt.adapters.relation_configs.config_base import RelationResults
from dbt.adapters.relation_configs.config_validation import RelationConfigValidationMixin
from dbt.contracts.graph.nodes import ModelNode
Expand Down Expand Up @@ -146,12 +147,55 @@ def parse_relation_results(cls, relation_results: RelationResults) -> dict:
return config_dict


@dataclass(frozen=True, eq=True, unsafe_hash=True)
class BigQueryAutoRefreshConfigChange(RelationConfigChange):
context: Optional[bool] = None

@property
def requires_full_refresh(self) -> bool:
return False


@dataclass(frozen=True, eq=True, unsafe_hash=True)
class BigQueryPartitionConfigChange(RelationConfigChange):
context: Optional[bool] = None

@property
def requires_full_refresh(self) -> bool:
return True


@dataclass(frozen=True, eq=True, unsafe_hash=True)
class BigQueryClusterConfigChange(RelationConfigChange):
context: Optional[bool] = None

@property
def requires_full_refresh(self) -> bool:
return True


@dataclass
class BigQueryMaterializedViewConfigChangeset:
partition_by: Optional[BigQueryPartitionConfigChange] = None
cluster_by: Optional[BigQueryClusterConfigChange] = None
auto_refresh: Optional[BigQueryAutoRefreshConfigChange] = None

@property
def requires_full_refresh(self) -> bool:
return True
return any(
{
self.auto_refresh.requires_full_refresh if self.auto_refresh else False,
self.partition_by.requires_full_refresh if self.partition_by else False,
self.cluster_by.requires_full_refresh if self.cluster_by else False,
}
)

@property
def has_changes(self) -> bool:
return True
return any(
{
self.partition_by if self.partition_by else False,
self.cluster_by if self.cluster_by else False,
self.auto_refresh if self.auto_refresh else False,
}
)

0 comments on commit eb34007

Please sign in to comment.