Skip to content

Commit 1943284

Browse files
authored
Fix: windows doesn't allow special characters in file paths (#1651)
1 parent 52214c5 commit 1943284

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

sqlmesh/utils/cache.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from sqlglot import __version__ as SQLGLOT_VERSION
1010

11+
from sqlmesh.utils import sanitize_name
1112
from sqlmesh.utils.errors import SQLMeshError
1213
from sqlmesh.utils.pydantic import PydanticModel
1314

@@ -118,4 +119,4 @@ def _cache_entry_path(self, name: str, entry_id: str) -> Path:
118119
entry_id,
119120
]
120121
)
121-
return self._path / entry_file_name
122+
return self._path / sanitize_name(entry_file_name)

tests/utils/test_cache.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def test_file_cache(tmp_path: Path, mocker: MockerFixture):
3636

3737
loader.assert_called_once()
3838

39+
assert cache._cache_entry_path('"test_model"', "").name[0:12] == "_test_model_"
40+
3941

4042
def test_optimized_query_cache(tmp_path: Path, mocker: MockerFixture):
4143
model = SqlModel(

0 commit comments

Comments
 (0)