Skip to content

feat: File Name Equals Model Name Linter #4534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tjirab
Copy link
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
Member

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

@izeigerman
Copy link
Member

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
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.

2 participants