Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Improve loader overriding #819

Closed
wants to merge 2 commits into from
Closed

Conversation

eakmanrq
Copy link
Contributor

@eakmanrq eakmanrq commented May 5, 2023

Prior behavior was as follows:

YAML < Python < Env

The issue is that when we create the config objects from the YAML definition we would validate with Pydantic that config and part of the required config could still be defined in environment variables.

The fix is to load the YAML into a dict and then apply the environment vars to that dict. After that we then create the Pydantic models. This means though that environment variables do not override what might be defined in Python models. So now the order is like this:
YAML < Env < Python

This does mean that env var overrides must be key based overrides but that already exists prior to this change.

@eakmanrq eakmanrq requested a review from izeigerman May 5, 2023 23:10
sqlmesh/utils/__init__.py Outdated Show resolved Hide resolved
@eakmanrq eakmanrq changed the title Improve loader overriding Fix: Improve loader overriding May 5, 2023
@eakmanrq eakmanrq marked this pull request as draft May 17, 2023 18:02
@eakmanrq eakmanrq closed this May 24, 2023
@eakmanrq eakmanrq deleted the eakmanrq/load_yaml_env_vars branch May 24, 2023 23:08
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.

2 participants