@@ -110,38 +110,7 @@ def deploy(
110110 if not legacy :
111111 self ._deploy_versioned (bundle_map = bundle_map , replace = replace , prune = prune )
112112 else :
113- console .step (f"Uploading artifacts to stage { self .model .stage } " )
114-
115- # We use a static method from StageManager here, but maybe this logic could be implemented elswhere, as we implement entities?
116- name = (
117- self .model .identifier .name
118- if isinstance (self .model .identifier , Identifier )
119- else self .model .identifier or self .entity_id
120- )
121- stage_root = StageManager .get_standard_stage_prefix (
122- f"{ FQN .from_string (self .model .stage ).using_connection (self ._conn )} /{ name } "
123- )
124- sync_deploy_root_with_stage (
125- console = self ._workspace_ctx .console ,
126- deploy_root = bundle_map .deploy_root (),
127- bundle_map = bundle_map ,
128- prune = prune ,
129- recursive = True ,
130- stage_path_parts = StageManager ().stage_path_parts_from_str (stage_root ),
131- print_diff = True ,
132- )
133-
134- console .step (f"Creating Streamlit object { self .model .fqn .sql_identifier } " )
135-
136- self ._execute_query (
137- self .get_deploy_sql (
138- replace = replace ,
139- from_stage_name = stage_root ,
140- legacy = True ,
141- )
142- )
143-
144- StreamlitManager (connection = self ._conn ).grant_privileges (self .model )
113+ self ._deploy_legacy (bundle_map = bundle_map , replace = replace , prune = prune )
145114
146115 return self .perform (EntityActions .GET_URL , action_context , * args , ** kwargs )
147116
@@ -244,6 +213,43 @@ def _object_exists(self) -> bool:
244213 except ProgrammingError :
245214 return False
246215
216+ def _deploy_legacy (
217+ self , bundle_map : BundleMap , replace : bool = False , prune : bool = False
218+ ):
219+ console = self ._workspace_ctx .console
220+ console .step (f"Uploading artifacts to stage { self .model .stage } " )
221+
222+ # We use a static method from StageManager here, but maybe this logic could be implemented elswhere, as we implement entities?
223+ name = (
224+ self .model .identifier .name
225+ if isinstance (self .model .identifier , Identifier )
226+ else self .model .identifier or self .entity_id
227+ )
228+ stage_root = StageManager .get_standard_stage_prefix (
229+ f"{ FQN .from_string (self .model .stage ).using_connection (self ._conn )} /{ name } "
230+ )
231+ sync_deploy_root_with_stage (
232+ console = self ._workspace_ctx .console ,
233+ deploy_root = bundle_map .deploy_root (),
234+ bundle_map = bundle_map ,
235+ prune = prune ,
236+ recursive = True ,
237+ stage_path_parts = StageManager ().stage_path_parts_from_str (stage_root ),
238+ print_diff = True ,
239+ )
240+
241+ console .step (f"Creating Streamlit object { self .model .fqn .sql_identifier } " )
242+
243+ self ._execute_query (
244+ self .get_deploy_sql (
245+ replace = replace ,
246+ from_stage_name = stage_root ,
247+ legacy = True ,
248+ )
249+ )
250+
251+ StreamlitManager (connection = self ._conn ).grant_privileges (self .model )
252+
247253 def _deploy_versioned (
248254 self , bundle_map : BundleMap , replace : bool = False , prune : bool = False
249255 ):
0 commit comments