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 5050 CustomKind ,
5151)
5252from sqlmesh .core .model .kind import _Incremental
53- from sqlmesh .utils import CompletionStatus
53+ from sqlmesh .utils import CompletionStatus , columns_to_types_all_known
5454from sqlmesh .core .schema_diff import (
5555 has_drop_alteration ,
5656 TableAlterOperation ,
@@ -747,6 +747,11 @@ def _evaluate_snapshot(
747747 adapter .execute (model .render_pre_statements (** render_statements_kwargs ))
748748
749749 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+ )
750755 if self ._can_clone (snapshot , deployability_index ):
751756 self ._clone_snapshot_in_dev (
752757 snapshot = snapshot ,
@@ -759,7 +764,7 @@ def _evaluate_snapshot(
759764 )
760765 runtime_stage = RuntimeStage .EVALUATING
761766 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 :
763768 self ._execute_create (
764769 snapshot = snapshot ,
765770 table_name = target_table_name ,
Original file line number Diff line number Diff line change @@ -646,7 +646,7 @@ def test_evaluate_materialized_view(
646646 )
647647
648648 # 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
650650
651651
652652def test_evaluate_materialized_view_with_partitioned_by_cluster_by (
You can’t perform that action at this time.
0 commit comments