5151 ViewKind ,
5252 CustomKind ,
5353)
54-
54+ from sqlmesh . utils import CompletionStatus
5555from sqlmesh .core .schema_diff import has_drop_alteration , get_dropped_column_names
5656from sqlmesh .core .snapshot import (
5757 DeployabilityIndex ,
@@ -287,20 +287,21 @@ def create(
287287 snapshots : t .Dict [SnapshotId , Snapshot ],
288288 deployability_index : t .Optional [DeployabilityIndex ] = None ,
289289 on_start : t .Optional [t .Callable ] = None ,
290- on_no_work : t .Optional [t .Callable ] = None ,
291290 on_complete : t .Optional [t .Callable [[SnapshotInfoLike ], None ]] = None ,
292291 allow_destructive_snapshots : t .Optional [t .Set [str ]] = None ,
293- ) -> None :
292+ ) -> CompletionStatus :
294293 """Creates a physical snapshot schema and table for the given collection of snapshots.
295294
296295 Args:
297296 target_snapshots: Target snapshots.
298297 snapshots: Mapping of snapshot ID to snapshot.
299298 deployability_index: Determines snapshots that are deployable in the context of this creation.
300299 on_start: A callback to initialize the snapshot creation progress bar.
301- on_no_work: A callback to call when no snapshots are to be created.
302300 on_complete: A callback to call on each successfully created snapshot.
303301 allow_destructive_snapshots: Set of snapshots that are allowed to have destructive schema changes.
302+
303+ Returns:
304+ CompletionStatus: The status of the creation operation (success, failure, nothing to do).
304305 """
305306 snapshots_with_table_names = defaultdict (set )
306307 tables_by_gateway_and_schema : t .Dict [t .Union [str , None ], t .Dict [exp .Table , set [str ]]] = (
@@ -368,9 +369,7 @@ def _get_data_objects(
368369 target_deployability_flags [snapshot .name ].sort ()
369370
370371 if not snapshots_to_create :
371- if on_no_work :
372- on_no_work ("\n [green]SKIP: No physical layer updates to perform[/green]\n " )
373- return
372+ return CompletionStatus .NOTHING_TO_DO
374373 if on_start :
375374 on_start (len (snapshots_to_create ))
376375
@@ -385,6 +384,7 @@ def _get_data_objects(
385384 on_complete = on_complete ,
386385 allow_destructive_snapshots = allow_destructive_snapshots ,
387386 )
387+ return CompletionStatus .SUCCESS
388388
389389 def _create_snapshots (
390390 self ,
0 commit comments