Skip to content

Commit d0cfec3

Browse files
authored
Feat: add glob pattern matching to --paths (#3373)
1 parent 6a324e7 commit d0cfec3

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

sqlmesh/core/config/loader.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import glob
34
import os
45
import typing as t
56
from pathlib import Path
@@ -27,7 +28,9 @@ def load_configs(
2728
config = config or "config"
2829

2930
absolute_paths = [
30-
Path(t.cast(t.Union[str, Path], path)).absolute() for path in ensure_list(paths)
31+
Path(t.cast(t.Union[str, Path], p)).absolute()
32+
for path in ensure_list(paths)
33+
for p in (glob.glob(str(path)) or [str(path)])
3134
]
3235

3336
if not isinstance(config, str):

tests/core/test_context.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,3 +997,10 @@ def post_statement(evaluator):
997997

998998
context = Context(paths=tmp_path, config=Config())
999999
context.plan(auto_apply=True, no_prompts=True)
1000+
1001+
1002+
def test_wildcard(copy_to_temp_path: t.Callable):
1003+
parent_path = copy_to_temp_path("examples/multi")[0]
1004+
1005+
context = Context(paths=f"{parent_path}/*")
1006+
assert len(context.models) == 4

0 commit comments

Comments
 (0)