feat: function to get range of key/value in model block#5119
Merged
Conversation
9728f66 to
6174549
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds the ability to return ranges for both the key and its value when parsing MODEL block properties, improving upon the previous implementation that only returned the key range.
- Refactored the dialect parsing code to be more robust and reusable
- Enhanced the
get_range_of_a_key_in_model_blockfunction to return both key and value ranges as a tuple - Added comprehensive test coverage for various MODEL block property types and structures
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| sqlmesh/core/linter/helpers.py | Complete rewrite of get_range_of_a_key_in_model_block to parse nested parentheses and return both key and value ranges |
| tests/core/linter/test_helpers.py | Updated tests to handle the new tuple return format and added specific test cases for different value types |
6174549 to
da3dad9
Compare
4822da8 to
cc4a7fc
Compare
georgesittas
approved these changes
Aug 15, 2025
Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stages of the changes
Actual changes