Skip to content

fix(config): parse default_test_connection from yaml - #6103

Open
manan28025 wants to merge 1 commit into
SQLMesh:mainfrom
manan28025:fix-default-test-connection-yaml
Open

manan28025 wants to merge 1 commit into
SQLMesh:mainfrom
manan28025:fix-default-test-connection-yaml

Conversation

@manan28025

Copy link
Copy Markdown

Description

Fixes #5584.

default_test_connection in config.yaml fails to load, even with the example from the docs. The connection validator is registered for default_test_connection, but on Config that's only the alias. The field is default_test_connection_. field_validator matches field names, and check_fields=False hides the mismatch, so the validator never ran. The YAML mapping was then validated against the abstract ConnectionConfig and 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

  • New test_default_test_connection_from_yaml fails on main with the error from the issue and passes with the fix.
  • Ran test_config, test_connection_config, test_test and test_context. The only failures need drivers I don't have installed (pyodbc, PyAthena, PySpark) and fail the same way on main.
  • Ran the config from the issue with sqlmesh info and sqlmesh test. It loads and the tests run against test.db.

Checklist

  • I have run make style and fixed any issues (ruff and ruff-format pass; mypy only reports pyspark not installed)
  • I have added tests for my changes (if applicable)
  • All existing tests pass (make fast-test) (ran the related suites above)
  • My commits are signed off (git commit -s) per the DCO

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>
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.

default_test_connection doesn't accept config shown in docs

2 participants