Fix: Only apply partition interval unit if partitioned_by is not set by the user explicitly #3636
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using INCREMENTAL_BY_TIME_RANGE models, SQLMesh automatically adjusts the table's partitioning to match the model's interval unit.
It turns out the logic for this applies to any model that uses partitioning, even though the original intention seems to have been aimed solely at INCREMENTAL_BY_TIME_RANGE models. This leads to unexpected results and behaviors, especially when the user explicitly specifies a certain partitioning scheme, but gets a different one in the resulting table.
This fix ensures that the partitioning based on the interval unit only applies to INCREMENTAL_BY_TIME_RANGE models and only if
partitioned_by
wasn't provided by the user directly.