Skip to content

Commit 748d9f9

Browse files
committed
added better message
1 parent 6603eaa commit 748d9f9

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

sqlmesh/core/linter/rules/builtin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
class NoSelectStar(Rule):
17-
"""Query should not contain SELECT * on its outermost projections, even if it can be expanded."""
17+
"""Query should not contain SELECT * on its outer most projections, even if it can be expanded."""
1818

1919
def check_model(self, model: Model) -> t.Optional[RuleViolation]:
2020
# Only applies to SQL models, as other model types do not have a query.
@@ -133,7 +133,7 @@ def check_model(self, model: Model) -> t.Optional[RuleViolation]:
133133
rule=self,
134134
violation_msg=f"Model '{model.name}' depends on unregistered external models: "
135135
f"{', '.join(m for m in not_registered_external_models)}. "
136-
"Please register them in the external_models.yaml file.",
136+
"Please register them in the external models file. This can be done by running 'sqlmesh create_external_models'.",
137137
)
138138

139139

vscode/extension/tests/quickfix.spec.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,29 @@ test('noselectstar quickfix', async ({ page, sharedCodeServer }) => {
1717
const configPath = path.join(tempDir, 'config.py')
1818
const read = await fs.readFile(configPath, 'utf8')
1919
// Replace linter to be on
20+
const target = 'enabled=True'
2021
const replaced = read.replace('enabled=False', 'enabled=True')
22+
// Assert replaced correctly
23+
expect(replaced).toContain(target)
24+
25+
// Replace the rules to only have noselectstar
26+
const targetRules = `rules=[
27+
"noselectstar",
28+
],
29+
`
2130
const replacedTheOtherRules = replaced.replace(
2231
`rules=[
2332
"ambiguousorinvalidcolumn",
2433
"invalidselectstarexpansion",
2534
"noselectstar",
2635
"nomissingaudits",
2736
"nomissingowner",
37+
"nomissingexternalmodels",
2838
],`,
29-
`rules=[
30-
"noselectstar",
31-
],
32-
`,
39+
target,
3340
)
41+
expect(replacedTheOtherRules).toContain(targetRules)
42+
3443
await fs.writeFile(configPath, replacedTheOtherRules)
3544
// Replace the file to cause the error
3645
const modelPath = path.join(tempDir, 'models', 'latest_order.sql')

0 commit comments

Comments
 (0)