Skip to content

Fix: Incorrect treatment of the model's table as missing when processing batches with index > 0#5560

Merged
izeigerman merged 1 commit intomainfrom
fix-creating-stage-for-all-batches
Oct 22, 2025
Merged

Fix: Incorrect treatment of the model's table as missing when processing batches with index > 0#5560
izeigerman merged 1 commit intomainfrom
fix-creating-stage-for-all-batches

Conversation

@izeigerman
Copy link
Contributor

Fixes #5555

@izeigerman izeigerman requested review from a team and Copilot October 22, 2025 19:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug where batches after the first batch (index > 0) incorrectly treated the model's target table as missing, causing the 'creating' runtime stage to execute multiple times instead of just once.

Key Changes:

  • Added logic to correctly determine target table existence for batches with index > 0
  • Added test case to verify the 'creating' stage only executes for the first batch

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sqlmesh/core/scheduler.py Fixed target table existence check to account for batch index
tests/core/integration/test_change_scenarios.py Added test case verifying 'creating' stage executes only once across multiple batches

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@izeigerman izeigerman force-pushed the fix-creating-stage-for-all-batches branch from a2c9229 to 55bef3a Compare October 22, 2025 19:49
@izeigerman izeigerman merged commit 15d2cd0 into main Oct 22, 2025
36 checks passed
@izeigerman izeigerman deleted the fix-creating-stage-for-all-batches branch October 22, 2025 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runtime_stage creating appears twice during plan application for new models

3 participants