File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 50
50
CustomKind ,
51
51
)
52
52
from sqlmesh .core .model .kind import _Incremental
53
- from sqlmesh .utils import CompletionStatus
53
+ from sqlmesh .utils import CompletionStatus , columns_to_types_all_known
54
54
from sqlmesh .core .schema_diff import (
55
55
has_drop_alteration ,
56
56
TableAlterOperation ,
@@ -747,6 +747,11 @@ def _evaluate_snapshot(
747
747
adapter .execute (model .render_pre_statements (** render_statements_kwargs ))
748
748
749
749
if not target_table_exists or (model .is_seed and not snapshot .intervals ):
750
+ columns_to_types_provided = (
751
+ model .kind .is_materialized
752
+ and model .columns_to_types_
753
+ and columns_to_types_all_known (model .columns_to_types_ )
754
+ )
750
755
if self ._can_clone (snapshot , deployability_index ):
751
756
self ._clone_snapshot_in_dev (
752
757
snapshot = snapshot ,
@@ -759,7 +764,7 @@ def _evaluate_snapshot(
759
764
)
760
765
runtime_stage = RuntimeStage .EVALUATING
761
766
target_table_exists = True
762
- elif model . annotated or model .is_seed or model .kind .is_scd_type_2 :
767
+ elif columns_to_types_provided or model .is_seed or model .kind .is_scd_type_2 :
763
768
self ._execute_create (
764
769
snapshot = snapshot ,
765
770
table_name = target_table_name ,
Original file line number Diff line number Diff line change @@ -646,7 +646,7 @@ def test_evaluate_materialized_view(
646
646
)
647
647
648
648
# Ensure that the materialized view is recreated even if it exists
649
- assert adapter_mock .create_view .assert_called
649
+ assert adapter_mock .create_view .call_count == 1
650
650
651
651
652
652
def test_evaluate_materialized_view_with_partitioned_by_cluster_by (
You can’t perform that action at this time.
0 commit comments