@@ -2241,6 +2241,11 @@ def insert(
22412241 column_descriptions = model .column_descriptions ,
22422242 truncate = is_first_insert ,
22432243 source_columns = source_columns ,
2244+ storage_format = model .storage_format ,
2245+ partitioned_by = model .partitioned_by ,
2246+ partition_interval_unit = model .partition_interval_unit ,
2247+ clustered_by = model .clustered_by ,
2248+ table_properties = kwargs .get ("physical_properties" , model .physical_properties ),
22442249 )
22452250 elif isinstance (model .kind , SCDType2ByColumnKind ):
22462251 self .adapter .scd_type_2_by_column (
@@ -2259,6 +2264,11 @@ def insert(
22592264 column_descriptions = model .column_descriptions ,
22602265 truncate = is_first_insert ,
22612266 source_columns = source_columns ,
2267+ storage_format = model .storage_format ,
2268+ partitioned_by = model .partitioned_by ,
2269+ partition_interval_unit = model .partition_interval_unit ,
2270+ clustered_by = model .clustered_by ,
2271+ table_properties = kwargs .get ("physical_properties" , model .physical_properties ),
22622272 )
22632273 else :
22642274 raise SQLMeshError (
@@ -2273,51 +2283,14 @@ def append(
22732283 render_kwargs : t .Dict [str , t .Any ],
22742284 ** kwargs : t .Any ,
22752285 ) -> None :
2276- # Source columns from the underlying table to prevent unintentional table schema changes during restatement of incremental models.
2277- columns_to_types , source_columns = self ._get_target_and_source_columns (
2278- model ,
2286+ return self .insert (
22792287 table_name ,
2288+ query_or_df ,
2289+ model ,
2290+ is_first_insert = False ,
22802291 render_kwargs = render_kwargs ,
2281- force_get_columns_from_target = True ,
2292+ ** kwargs ,
22822293 )
2283- if isinstance (model .kind , SCDType2ByTimeKind ):
2284- self .adapter .scd_type_2_by_time (
2285- target_table = table_name ,
2286- source_table = query_or_df ,
2287- unique_key = model .unique_key ,
2288- valid_from_col = model .kind .valid_from_name ,
2289- valid_to_col = model .kind .valid_to_name ,
2290- updated_at_col = model .kind .updated_at_name ,
2291- invalidate_hard_deletes = model .kind .invalidate_hard_deletes ,
2292- updated_at_as_valid_from = model .kind .updated_at_as_valid_from ,
2293- target_columns_to_types = columns_to_types ,
2294- table_format = model .table_format ,
2295- table_description = model .description ,
2296- column_descriptions = model .column_descriptions ,
2297- source_columns = source_columns ,
2298- ** kwargs ,
2299- )
2300- elif isinstance (model .kind , SCDType2ByColumnKind ):
2301- self .adapter .scd_type_2_by_column (
2302- target_table = table_name ,
2303- source_table = query_or_df ,
2304- unique_key = model .unique_key ,
2305- valid_from_col = model .kind .valid_from_name ,
2306- valid_to_col = model .kind .valid_to_name ,
2307- check_columns = model .kind .columns ,
2308- target_columns_to_types = columns_to_types ,
2309- table_format = model .table_format ,
2310- invalidate_hard_deletes = model .kind .invalidate_hard_deletes ,
2311- execution_time_as_valid_from = model .kind .execution_time_as_valid_from ,
2312- table_description = model .description ,
2313- column_descriptions = model .column_descriptions ,
2314- source_columns = source_columns ,
2315- ** kwargs ,
2316- )
2317- else :
2318- raise SQLMeshError (
2319- f"Unexpected SCD Type 2 kind: { model .kind } . This is not expected and please report this as a bug."
2320- )
23212294
23222295
23232296class ViewStrategy (PromotableStrategy ):
0 commit comments