Summary
sqlmesh lint can target models with --model NAME, but not with file paths. Pre-commit and other path-based tools pass filenames, so lint cannot be wired up without a wrapper that maps paths to names.
Current behavior
sqlmesh lint --model sushi.orders works
sqlmesh lint models/orders.sql is a Click extra-arg error
sqlmesh lint --model models/orders.sql looks up a model with that name and fails
--local and --use-project-index already exist and should keep working when the selection comes from paths.
Proposed CLI
sqlmesh lint --local --use-project-index models/a.sql models/b.py
- Add a positional paths argument (nargs=-1), same shape as
sqlmesh format
- Resolve each path to the model(s) whose _path matches
- Keep
--model for names; paths and --model can be combined
- No paths and no
--model still lints every model
- With
--use-project-index, path resolution should use the index (relative path -> FQNs) so unrelated models are not loaded
Acceptance
- Lint of one changed model file does not lint the rest of the project
- Python and SQL model files both work
- Unknown path fails with a clear error (does not lint everything)
- Existing
--model usage is unchanged
Summary
sqlmesh lintcan target models with --model NAME, but not with file paths. Pre-commit and other path-based tools pass filenames, so lint cannot be wired up without a wrapper that maps paths to names.Current behavior
sqlmesh lint --model sushi.ordersworkssqlmesh lint models/orders.sqlis a Click extra-arg errorsqlmesh lint --model models/orders.sqllooks up a model with that name and fails--localand--use-project-indexalready exist and should keep working when the selection comes from paths.Proposed CLI
sqlmesh lint --local --use-project-index models/a.sql models/b.pysqlmesh format--modelfor names; paths and--modelcan be combined--modelstill lints every model--use-project-index, path resolution should use the index (relative path -> FQNs) so unrelated models are not loadedAcceptance
--modelusage is unchanged