|
23 | 23 | ApiResponseGetLineage, |
24 | 24 | ApiResponseGetModels, |
25 | 25 | ) |
26 | | -from sqlmesh.lsp.commands import ExternalModelUpdateColumnsRequest, EXTERNAL_MODEL_UPDATE_COLUMNS |
| 26 | +from sqlmesh.lsp.commands import EXTERNAL_MODEL_UPDATE_COLUMNS |
27 | 27 | from sqlmesh.lsp.completions import get_sql_completions |
28 | 28 | from sqlmesh.lsp.context import ( |
29 | 29 | LSPContext, |
@@ -325,31 +325,28 @@ def command_external_models_update_columns(ls: LanguageServer, raw: t.Any) -> No |
325 | 325 | if not isinstance(model_name, str): |
326 | 326 | raise ValueError("Command parameter must be a string") |
327 | 327 |
|
328 | | - request = ExternalModelUpdateColumnsRequest(model_name=model_name) |
329 | 328 | context = self._context_get_or_load() |
330 | 329 | if not isinstance(context, LSPContext): |
331 | 330 | raise ValueError("Context is not loaded or invalid") |
332 | | - model = context.context.get_model(request.model_name) |
| 331 | + model = context.context.get_model(model_name) |
333 | 332 | if model is None: |
334 | | - raise ValueError(f"External model '{request.model_name}' not found") |
| 333 | + raise ValueError(f"External model '{model_name}' not found") |
335 | 334 | if model._path is None: |
336 | | - raise ValueError( |
337 | | - f"External model '{request.model_name}' does not have a file path" |
338 | | - ) |
| 335 | + raise ValueError(f"External model '{model_name}' does not have a file path") |
339 | 336 | uri = URI.from_path(model._path) |
340 | 337 | updated = context.update_external_model_columns( |
341 | 338 | ls=ls, |
342 | 339 | uri=uri, |
343 | | - model_name=request.model_name, |
| 340 | + model_name=model_name, |
344 | 341 | ) |
345 | 342 | if updated: |
346 | 343 | ls.show_message( |
347 | | - f"Updated columns for '{request.model_name}'", |
| 344 | + f"Updated columns for '{model_name}'", |
348 | 345 | types.MessageType.Info, |
349 | 346 | ) |
350 | 347 | else: |
351 | 348 | ls.show_message( |
352 | | - f"Columns for '{request.model_name}' are already up to date", |
| 349 | + f"Columns for '{model_name}' are already up to date", |
353 | 350 | ) |
354 | 351 | except Exception as e: |
355 | 352 | ls.show_message(f"Error executing command: {e}", types.MessageType.Error) |
|
0 commit comments