fix: gather engine_adapters from all projects#4977
Merged
themisvaltinos merged 1 commit intoSQLMesh:mainfrom Jul 17, 2025
Merged
fix: gather engine_adapters from all projects#4977themisvaltinos merged 1 commit intoSQLMesh:mainfrom
engine_adapters from all projects#4977themisvaltinos merged 1 commit intoSQLMesh:mainfrom
Conversation
338f642 to
381e55a
Compare
Contributor
themisvaltinos
left a comment
There was a problem hiding this comment.
Thanks for your contribution it looks good, can you also add a test for this?
For example in tests/core/test_integration.py something like:
def test_engine_adapters_multi_repo_all_gateways_gathered(copy_to_temp_path):
paths = copy_to_temp_path("examples/multi")
repo_1_path = f"{paths[0]}/repo_1"
repo_2_path = f"{paths[0]}/repo_2"
# Add an extra gateway to repo_2's config
repo_2_config_path = f"{repo_2_path}/config.yaml"
with open(repo_2_config_path, "r") as f:
config_content = f.read()
modified_config = config_content.replace(
"default_gateway: local",
""" extra:
connection:
type: duckdb
database: extra.duckdb
default_gateway: local"""
)
with open(repo_2_config_path, "w") as f:
f.write(modified_config)
# Create context with both repos but using the repo_1 path first
context = Context(paths=[repo_1_path, repo_2_path], gateway="memory")
# Verify all gateways from both repos are present
adapters = context.engine_adapters
expected_gateways = {"local", "memory", "extra"}
missing = expected_gateways - set(adapters.keys())
assert not missing381e55a to
38b3299
Compare
38b3299 to
4604122
Compare
Contributor
Author
Certainly. Thank you for the starting point 🙏 |
themisvaltinos
approved these changes
Jul 17, 2025
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.
Trying to use
sqlmesh renderwith multiple projects can fail withGateway '{gateway}' not found in the available engine adapters.This is because theContext.engine_adaptersonly looks atself.configinstead ofself.configs. This PR modifies the definition ofengine_adaptersto look at all projects, thereby avoiding this issue.