Skip to content

Commit aecdfb1

Browse files
committed
Fix: Report models for which physical table creation was skipped due to a failure upstream
1 parent 83e7053 commit aecdfb1

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

sqlmesh/core/plan/evaluator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ def _should_create(s: Snapshot) -> bool:
299299
for error in ex.errors:
300300
logger.info(str(error), exc_info=error)
301301

302+
self.console.log_skipped_models({s.name for s in ex.skipped})
302303
self.console.log_failed_models(ex.errors)
303304

304305
raise PlanError("Plan application failed.")

sqlmesh/core/snapshot/evaluator.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,13 @@
8989

9090

9191
class SnapshotCreationFailedError(SQLMeshError):
92-
def __init__(self, errors: t.List[NodeExecutionFailedError[SnapshotId]]):
92+
def __init__(
93+
self, errors: t.List[NodeExecutionFailedError[SnapshotId]], skipped: t.List[SnapshotId]
94+
):
9395
messages = "\n\n".join(f"{error}\n {error.__cause__}" for error in errors)
9496
super().__init__(f"Physical table creation failed:\n\n{messages}")
9597
self.errors = errors
98+
self.skipped = skipped
9699

97100

98101
class SnapshotEvaluator:
@@ -405,7 +408,7 @@ def _create_snapshots(
405408
) -> None:
406409
"""Internal method to create tables in parallel."""
407410
with self.concurrent_context():
408-
errors, _ = concurrent_apply_to_snapshots(
411+
errors, skipped = concurrent_apply_to_snapshots(
409412
snapshots_to_create,
410413
lambda s: self._create_snapshot(
411414
s,
@@ -419,7 +422,7 @@ def _create_snapshots(
419422
raise_on_error=False,
420423
)
421424
if errors:
422-
raise SnapshotCreationFailedError(errors)
425+
raise SnapshotCreationFailedError(errors, skipped)
423426

424427
def migrate(
425428
self,

0 commit comments

Comments
 (0)