You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into a issue with creating new models when launching the UI if the project is a symlinked directory. There are a couple of problems:
files created in the UI are not picked up unless the browser is refreshed
new models are not picked up even if the browser is refreshed
changes to models are not picked up unless the browser is refreshed
Making a change to an existing model then refreshing the browser will enable the UI to pick up new models added.
To reproduce
# Create a SLQMesh project
rm -rf ~/sqlmesh-repro
mkdir -p ~/sqlmesh-repro/real
cd~/sqlmesh-repro/real
uv venv --python 3.13
source .venv/bin/activate
uv pip install "sqlmesh[web]"
sqlmesh init duckdb
# Symlink to another directory and launch the UI
ln -s ~/sqlmesh-repro/real ~/sqlmesh-repro/linked
sqlmesh -p ~/sqlmesh-repro/linked ui
Then try to create a new model in the UI. It will only be picked up if an existing model is modified and the browser is then refreshed.
Cause
I think part of the problem is in web/server/watcher.py. The watcher watches the project at the path you launched with (i.e. the symlinked path) so the change events coming from watchfiles.awatch carry symlinked paths. But the list of model directories it checks each event against is built with .resolve(), which expands the symlink back to the real location:
And so changes are not picked up by the watcher. I'm not sure why refreshing the browser would make a difference, nor why modifying an existing model is needed for new models to be picked up?
I appreciate the browser is deprecated, but I'm finding it quite useful for now, and I'm happy to make a PR to fix this.
Hi, thanks for making SQLMesh!
I'm running into a issue with creating new models when launching the UI if the project is a symlinked directory. There are a couple of problems:
Making a change to an existing model then refreshing the browser will enable the UI to pick up new models added.
To reproduce
Then try to create a new model in the UI. It will only be picked up if an existing model is modified and the browser is then refreshed.
Cause
I think part of the problem is in
web/server/watcher.py. The watcher watches the project at the path you launched with (i.e. the symlinked path) so the change events coming fromwatchfiles.awatchcarry symlinked paths. But the list of model directories it checks each event against is built with.resolve(), which expands the symlink back to the real location:sqlmesh/web/server/watcher.py
Lines 24 to 30 in 192fbe9
This means the following check is always
Falsefor symlinked files:sqlmesh/web/server/watcher.py
Line 79 in 192fbe9
And so changes are not picked up by the watcher. I'm not sure why refreshing the browser would make a difference, nor why modifying an existing model is needed for new models to be picked up?
I appreciate the browser is deprecated, but I'm finding it quite useful for now, and I'm happy to make a PR to fix this.
Environment:
sqlmesh: 0.235.4
python: 3.13
os: macOS (Darwin 24.5.0, x86_64)
Here's a video showing the broken behaviour:
sqlmesh-ui-new-model-with-symlinked-project.mov