@@ -598,20 +598,25 @@ def _create_snapshot(
598598 deployability_index = deployability_index or DeployabilityIndex .all_deployable ()
599599 is_snapshot_deployable = deployability_index .is_deployable (snapshot )
600600
601- # Refers to self as non-deployable to successfully create self-referential tables / views.
602- deployability_index = deployability_index .with_non_deployable (snapshot )
603-
604- render_kwargs : t .Dict [str , t .Any ] = dict (
601+ common_render_kwargs : t .Dict [str , t .Any ] = dict (
605602 engine_adapter = self .adapter ,
606603 snapshots = parent_snapshots_by_name ,
607- deployability_index = deployability_index ,
608604 runtime_stage = RuntimeStage .CREATING ,
609605 )
606+ pre_post_render_kwargs = dict (
607+ ** common_render_kwargs ,
608+ deployability_index = deployability_index .with_deployable (snapshot ),
609+ )
610+ create_render_kwargs = dict (
611+ ** common_render_kwargs ,
612+ # Refers to self as non-deployable to successfully create self-referential tables / views.
613+ deployability_index = deployability_index .with_non_deployable (snapshot ),
614+ )
610615
611616 evaluation_strategy = _evaluation_strategy (snapshot , self .adapter )
612617
613618 with self .adapter .transaction (), self .adapter .session (snapshot .model .session_properties ):
614- self .adapter .execute (snapshot .model .render_pre_statements (** render_kwargs ))
619+ self .adapter .execute (snapshot .model .render_pre_statements (** pre_post_render_kwargs ))
615620
616621 if (
617622 snapshot .is_forward_only
@@ -626,7 +631,7 @@ def _create_snapshot(
626631 logger .info (f"Cloning table '{ source_table_name } ' into '{ target_table_name } '" )
627632
628633 evaluation_strategy .create (
629- snapshot , tmp_table_name , False , is_snapshot_deployable , ** render_kwargs
634+ snapshot , tmp_table_name , False , is_snapshot_deployable , ** create_render_kwargs
630635 )
631636 try :
632637 self .adapter .clone_table (target_table_name , snapshot .table_name (), replace = True )
@@ -643,10 +648,10 @@ def _create_snapshot(
643648 snapshot .table_name (is_deployable = is_table_deployable ),
644649 is_table_deployable ,
645650 is_snapshot_deployable ,
646- ** render_kwargs ,
651+ ** create_render_kwargs ,
647652 )
648653
649- self .adapter .execute (snapshot .model .render_post_statements (** render_kwargs ))
654+ self .adapter .execute (snapshot .model .render_post_statements (** pre_post_render_kwargs ))
650655
651656 if on_complete is not None :
652657 on_complete (snapshot )
0 commit comments