fix(config): parse default_test_connection from yaml - #6103
Open
manan28025 wants to merge 1 commit into
Open
manan28025 wants to merge 1 commit into
manan28025 wants to merge 1 commit into
Conversation
The connection validator was registered for the alias default_test_connection, but field_validator matches field names, so the default_test_connection_ field never got it. A YAML mapping was validated against the abstract ConnectionConfig and rejected. Signed-off-by: neatninja <manan81140@gmail.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.
Description
Fixes #5584.
default_test_connectionin config.yaml fails to load, even with the example from the docs. The connection validator is registered fordefault_test_connection, but onConfigthat's only the alias. The field isdefault_test_connection_.field_validatormatches field names, andcheck_fields=Falsehides the mismatch, so the validator never ran. The YAML mapping was then validated against the abstractConnectionConfigand rejected. Python configs weren't affected because they pass an instance.The fix points the validator at the field name. No other config model has a validator pointed at an alias.
Test Plan
test_default_test_connection_from_yamlfails on main with the error from the issue and passes with the fix.sqlmesh infoandsqlmesh test. It loads and the tests run against test.db.Checklist
make styleand fixed any issues (ruff and ruff-format pass; mypy only reports pyspark not installed)make fast-test) (ran the related suites above)git commit -s) per the DCO