Skip to content

Commit b0e455b

Browse files
authored
fix: correctly have scd models depend on past (#4107)
1 parent 8db5700 commit b0e455b

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

sqlmesh/core/model/kind.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ def only_execution_time(self) -> bool:
131131
@property
132132
def full_history_restatement_only(self) -> bool:
133133
"""Whether or not this model only supports restatement of full history."""
134-
return self.model_kind_name in (
135-
ModelKindName.INCREMENTAL_UNMANAGED,
136-
ModelKindName.INCREMENTAL_BY_UNIQUE_KEY,
137-
ModelKindName.INCREMENTAL_BY_PARTITION,
138-
ModelKindName.SCD_TYPE_2,
139-
ModelKindName.MANAGED,
140-
ModelKindName.FULL,
141-
ModelKindName.VIEW,
134+
return (
135+
self.is_incremental_unmanaged
136+
or self.is_incremental_by_unique_key
137+
or self.is_incremental_by_partition
138+
or self.is_scd_type_2
139+
or self.is_managed
140+
or self.is_full
141+
or self.is_view
142142
)
143143

144144
@property

tests/core/test_model.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8665,3 +8665,10 @@ def test_data_hash_unchanged_when_column_type_uses_default_dialect():
86658665

86668666
# int == int64 in bigquery
86678667
assert model.data_hash == deserialized_model.data_hash
8668+
8669+
8670+
def test_scd_type_2_full_history_restatement():
8671+
assert ModelKindName.SCD_TYPE_2.full_history_restatement_only is True
8672+
assert ModelKindName.SCD_TYPE_2_BY_TIME.full_history_restatement_only is True
8673+
assert ModelKindName.SCD_TYPE_2_BY_COLUMN.full_history_restatement_only is True
8674+
assert ModelKindName.INCREMENTAL_BY_TIME_RANGE.full_history_restatement_only is False

0 commit comments

Comments
 (0)