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 ,
@@ -279,20 +279,21 @@ def create(
279279 snapshots : t .Dict [SnapshotId , Snapshot ],
280280 deployability_index : t .Optional [DeployabilityIndex ] = None ,
281281 on_start : t .Optional [t .Callable ] = None ,
282- on_no_work : t .Optional [t .Callable ] = None ,
283282 on_complete : t .Optional [t .Callable [[SnapshotInfoLike ], None ]] = None ,
284283 allow_destructive_snapshots : t .Optional [t .Set [str ]] = None ,
285- ) -> None :
284+ ) -> CompletionStatus :
286285 """Creates a physical snapshot schema and table for the given collection of snapshots.
287286
288287 Args:
289288 target_snapshots: Target snapshots.
290289 snapshots: Mapping of snapshot ID to snapshot.
291290 deployability_index: Determines snapshots that are deployable in the context of this creation.
292291 on_start: A callback to initialize the snapshot creation progress bar.
293- on_no_work: A callback to call when no snapshots are to be created.
294292 on_complete: A callback to call on each successfully created snapshot.
295293 allow_destructive_snapshots: Set of snapshots that are allowed to have destructive schema changes.
294+
295+ Returns:
296+ CompletionStatus: The status of the creation operation (success, failure, nothing to do).
296297 """
297298 snapshots_with_table_names = defaultdict (set )
298299 tables_by_schema = defaultdict (set )
@@ -350,9 +351,7 @@ def _get_data_objects(schema: exp.Table, gateway: t.Optional[str] = None) -> t.S
350351 target_deployability_flags [snapshot .name ].sort ()
351352
352353 if not snapshots_to_create :
353- if on_no_work :
354- on_no_work ("\n [green]SKIP: No physical layer updates to perform[/green]\n " )
355- return
354+ return CompletionStatus .NOTHING_TO_DO
356355 if on_start :
357356 on_start (len (snapshots_to_create ))
358357 self ._create_schemas (tables_by_schema , gateway_by_schema )
@@ -364,6 +363,7 @@ def _get_data_objects(schema: exp.Table, gateway: t.Optional[str] = None) -> t.S
364363 on_complete = on_complete ,
365364 allow_destructive_snapshots = allow_destructive_snapshots ,
366365 )
366+ return CompletionStatus .SUCCESS
367367
368368 def _create_snapshots (
369369 self ,
0 commit comments