Skip to content

feat: File Name Equals Model Name Linter#4534

Closed
tjirab wants to merge 4 commits intoSQLMesh:mainfrom
tjirab:feat/file-name-check-linter
Closed

feat: File Name Equals Model Name Linter#4534
tjirab wants to merge 4 commits intoSQLMesh:mainfrom
tjirab:feat/file-name-check-linter

Conversation

@tjirab
Copy link
Copy Markdown
Contributor

@tjirab tjirab commented May 26, 2025

A linter to assert whether the file name (e.g. mymodel in foo/bar/mymodel.sql) matches the model name (e.g. mymodel in myschema.mymodel).

@izeigerman
Copy link
Copy Markdown
Collaborator

Hey @tjirab ! Thanks for your contribution! Can you please run make style and add a test for this

@izeigerman
Copy link
Copy Markdown
Collaborator

izeigerman commented May 26, 2025

Also can you please share a bit more motivation behind this rule and why the following config cannot be used instead?

model_naming:
    infer_names: True

? For reference: https://sqlmesh.readthedocs.io/en/latest/guides/configuration/#model-naming

@tjirab
Copy link
Copy Markdown
Contributor Author

tjirab commented May 27, 2025

Thanks @izeigerman for taking a look. Regarding the infer_names feature: I wasn't aware of this feature.

Example with infer_names enabled: /sources/google_sheets/quotas.sql would be built in catalog sources, schema google_sheets, table quotas whereas the preference is to put them into schema sources: sources.quotas.

This then should be managed in environment_catalog_mapping, is that correct? (ref). That would make this entire test redundant I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants