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
Copy file name to clipboardExpand all lines: docs/guides/configuration.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -329,6 +329,16 @@ By default, the SQLMesh cache is stored in a `.cache` directory within your proj
329
329
330
330
The cache directory is automatically created if it doesn't exist. You can clear the cache using the `sqlmesh clean` command.
331
331
332
+
#### Project index
333
+
334
+
The `--use-project-index` option on supported commands maintains a persistent model dependency index in the cache directory. Each project writes a file named `<project>_<hash>_model_index.json`.
335
+
336
+
A full project load with the option enabled creates or refreshes the index. SQLMesh invalidates it when relevant configuration, gateway, macro, audit, or signal metadata changes, or when the set of model files changes. If the index is missing, invalid, or stale, SQLMesh safely falls back to a full project load and rebuilds it.
337
+
338
+
For operations targeting selected models, the index allows SQLMesh to load only those models and their upstream dependencies.
339
+
340
+
In multi-repository projects, dependencies that cross project boundaries may not be represented by an individual project's index. SQLMesh detects incomplete scoped loads and falls back to loading the full configured project set.
341
+
332
342
### Table/view storage locations
333
343
334
344
SQLMesh creates schemas, physical tables, and views in the data warehouse/engine. Learn more about why and how SQLMesh creates schema in the ["Why does SQLMesh create schemas?" FAQ](../faq/faq.md#schema-question).
Copy file name to clipboardExpand all lines: docs/guides/linter.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,6 +135,21 @@ $ sqlmesh lint --local
135
135
136
136
This can make linting faster in repositories where all referenced models are loaded from local files. In multi-repository setups, or when linting only a subset of projects, `--local` may cause additional linting errors because SQLMesh will not resolve references or schemas from models that exist only in remote state.
137
137
138
+
For faster targeted linting, enable the persistent project index with `--use-project-index`. When
139
+
models are selected with `--model`, SQLMesh loads, resolves, and validates only those models and
140
+
their transitive upstream dependencies. The same behavior can be enabled by default for the
141
+
Python API and CLI with the `linter.use_project_index` configuration option:
142
+
143
+
```yaml
144
+
linter:
145
+
enabled: true
146
+
use_project_index: true
147
+
```
148
+
149
+
`Context.lint_models` uses this configuration value when `use_project_index` is omitted. Passing
150
+
`use_project_index=False`explicitly disables it for that call. If a context was already loaded,
151
+
an indexed lint of selected models reloads the context so the requested scope is applied.
|`linter.enabled`| Whether linting is enabled (Default: `False`) | boolean | N |
68
+
|`linter.use_project_index`| Whether to use the persistent project index for linting. Targeted linting loads selected models and their upstream dependencies. (Default: `False`) | boolean | N |
69
+
63
70
### Variables
64
71
65
72
The `variables` key can be used to provide values for user-defined variables, accessed using the [`@VAR` macro function](../concepts/macros/sqlmesh_macros.md#global-variables) in SQL model definitions, [`context.var` method](../concepts/models/python_models.md#global-variables) in Python model definitions, and [`evaluator.var` method](../concepts/macros/sqlmesh_macros.md#accessing-global-variable-values) in Python macro functions.
help="A model to lint. Multiple models can be linted. If no models are specified, every model will be linted.",
1211
1215
)
1216
+
@click.option(
1217
+
"--use-project-index",
1218
+
is_flag=True,
1219
+
default=None,
1220
+
help="Use the persistent project index. With --model, only the selected models and their upstream dependencies are loaded, resolved, and validated, so errors in unrelated models are not reported. Without --model, every model is still loaded and linted. Can also be enabled with linter.use_project_index.",
0 commit comments