6666from sqlmesh .utils .concurrency import (
6767 concurrent_apply_to_snapshots ,
6868 concurrent_apply_to_values ,
69+ NodeExecutionFailedError ,
6970)
7071from sqlmesh .utils .date import TimeLike , now , time_like_to_str
7172from sqlmesh .utils .errors import (
8788logger = logging .getLogger (__name__ )
8889
8990
91+ class SnapshotCreationFailedError (SQLMeshError ):
92+ def __init__ (self , errors : t .List [NodeExecutionFailedError [SnapshotId ]]):
93+ messages = "\n \n " .join (f"{ error } \n { error .__cause__ } " for error in errors )
94+ super ().__init__ (f"Physical table creation failed:\n \n { messages } " )
95+ self .errors = errors
96+
97+
9098class SnapshotEvaluator :
9199 """Evaluates a snapshot given runtime arguments through an arbitrary EngineAdapter.
92100
@@ -397,7 +405,7 @@ def _create_snapshots(
397405 ) -> None :
398406 """Internal method to create tables in parallel."""
399407 with self .concurrent_context ():
400- concurrent_apply_to_snapshots (
408+ errors , _ = concurrent_apply_to_snapshots (
401409 snapshots_to_create ,
402410 lambda s : self ._create_snapshot (
403411 s ,
@@ -408,7 +416,10 @@ def _create_snapshots(
408416 allow_destructive_snapshots = allow_destructive_snapshots ,
409417 ),
410418 self .ddl_concurrent_tasks ,
419+ raise_on_error = False ,
411420 )
421+ if errors :
422+ raise SnapshotCreationFailedError (errors )
412423
413424 def migrate (
414425 self ,
0 commit comments