sqlmesh 0.193.1.dev7__py3-none-any.whl → 0.193.1.dev9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sqlmesh/_version.py +2 -2
- sqlmesh/core/plan/explainer.py +5 -5
- sqlmesh/core/plan/stages.py +8 -1
- sqlmesh/lsp/main.py +99 -148
- {sqlmesh-0.193.1.dev7.dist-info → sqlmesh-0.193.1.dev9.dist-info}/METADATA +1 -1
- {sqlmesh-0.193.1.dev7.dist-info → sqlmesh-0.193.1.dev9.dist-info}/RECORD +10 -10
- {sqlmesh-0.193.1.dev7.dist-info → sqlmesh-0.193.1.dev9.dist-info}/WHEEL +0 -0
- {sqlmesh-0.193.1.dev7.dist-info → sqlmesh-0.193.1.dev9.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.193.1.dev7.dist-info → sqlmesh-0.193.1.dev9.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.193.1.dev7.dist-info → sqlmesh-0.193.1.dev9.dist-info}/top_level.txt +0 -0
sqlmesh/_version.py
CHANGED
|
@@ -17,5 +17,5 @@ __version__: str
|
|
|
17
17
|
__version_tuple__: VERSION_TUPLE
|
|
18
18
|
version_tuple: VERSION_TUPLE
|
|
19
19
|
|
|
20
|
-
__version__ = version = '0.193.1.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 193, 1, '
|
|
20
|
+
__version__ = version = '0.193.1.dev9'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 193, 1, 'dev9')
|
sqlmesh/core/plan/explainer.py
CHANGED
|
@@ -90,16 +90,16 @@ class RichExplainerConsole(ExplainerConsole):
|
|
|
90
90
|
return Tree("[bold]Execute after all statements[/bold]")
|
|
91
91
|
|
|
92
92
|
def visit_physical_layer_update_stage(self, stage: stages.PhysicalLayerUpdateStage) -> Tree:
|
|
93
|
-
|
|
93
|
+
snapshots = [
|
|
94
|
+
s for s in stage.snapshots if s.snapshot_id in stage.snapshots_with_missing_intervals
|
|
95
|
+
]
|
|
96
|
+
if not snapshots:
|
|
94
97
|
return Tree("[bold]SKIP: No physical layer updates to perform[/bold]")
|
|
95
98
|
|
|
96
99
|
tree = Tree(
|
|
97
100
|
"[bold]Validate SQL and create physical layer tables and views if they do not exist[/bold]"
|
|
98
101
|
)
|
|
99
|
-
for snapshot in
|
|
100
|
-
if snapshot.snapshot_id not in stage.snapshots_with_missing_intervals:
|
|
101
|
-
continue
|
|
102
|
-
|
|
102
|
+
for snapshot in snapshots:
|
|
103
103
|
is_deployable = (
|
|
104
104
|
stage.deployability_index.is_deployable(snapshot)
|
|
105
105
|
if self.environment_naming_info.name != c.PROD
|
sqlmesh/core/plan/stages.py
CHANGED
|
@@ -8,6 +8,7 @@ from sqlmesh.core.scheduler import merged_missing_intervals, SnapshotToIntervals
|
|
|
8
8
|
from sqlmesh.core.snapshot.definition import (
|
|
9
9
|
DeployabilityIndex,
|
|
10
10
|
Snapshot,
|
|
11
|
+
SnapshotChangeCategory,
|
|
11
12
|
SnapshotTableInfo,
|
|
12
13
|
SnapshotId,
|
|
13
14
|
Interval,
|
|
@@ -255,7 +256,13 @@ class PlanStagesBuilder:
|
|
|
255
256
|
if s.is_paused
|
|
256
257
|
and s.is_model
|
|
257
258
|
and not s.is_symbolic
|
|
258
|
-
and (
|
|
259
|
+
and (
|
|
260
|
+
not deployability_index_for_creation.is_representative(s)
|
|
261
|
+
or (
|
|
262
|
+
s.is_view
|
|
263
|
+
and s.change_category == SnapshotChangeCategory.INDIRECT_NON_BREAKING
|
|
264
|
+
)
|
|
265
|
+
)
|
|
259
266
|
]
|
|
260
267
|
|
|
261
268
|
snapshots_to_intervals = self._missing_intervals(
|
sqlmesh/lsp/main.py
CHANGED
|
@@ -74,6 +74,8 @@ class SQLMeshLanguageServer:
|
|
|
74
74
|
self.lsp_context: t.Optional[LSPContext] = None
|
|
75
75
|
self.workspace_folders: t.List[Path] = []
|
|
76
76
|
|
|
77
|
+
self.has_raised_loading_error: bool = False
|
|
78
|
+
|
|
77
79
|
self.client_supports_pull_diagnostics = False
|
|
78
80
|
self._supported_custom_methods: t.Dict[
|
|
79
81
|
str,
|
|
@@ -94,29 +96,6 @@ class SQLMeshLanguageServer:
|
|
|
94
96
|
# Register LSP features (e.g., formatting, hover, etc.)
|
|
95
97
|
self._register_features()
|
|
96
98
|
|
|
97
|
-
def _create_lsp_context(self, paths: t.List[Path]) -> t.Optional[LSPContext]:
|
|
98
|
-
"""Create a new LSPContext instance using the configured context class.
|
|
99
|
-
|
|
100
|
-
On success, sets self.lsp_context and returns the created context.
|
|
101
|
-
|
|
102
|
-
Args:
|
|
103
|
-
paths: List of paths to pass to the context constructor
|
|
104
|
-
|
|
105
|
-
Returns:
|
|
106
|
-
A new LSPContext instance wrapping the created context, or None if creation fails
|
|
107
|
-
"""
|
|
108
|
-
try:
|
|
109
|
-
if self.lsp_context is None:
|
|
110
|
-
context = self.context_class(paths=paths)
|
|
111
|
-
else:
|
|
112
|
-
self.lsp_context.context.load()
|
|
113
|
-
context = self.lsp_context.context
|
|
114
|
-
self.lsp_context = LSPContext(context)
|
|
115
|
-
return self.lsp_context
|
|
116
|
-
except Exception as e:
|
|
117
|
-
self.server.log_trace(f"Error creating context: {e}")
|
|
118
|
-
return None
|
|
119
|
-
|
|
120
99
|
# All the custom LSP methods are registered here and prefixed with _custom
|
|
121
100
|
def _custom_all_models(self, ls: LanguageServer, params: AllModelsRequest) -> AllModelsResponse:
|
|
122
101
|
uri = URI(params.textDocument.uri)
|
|
@@ -145,26 +124,16 @@ class SQLMeshLanguageServer:
|
|
|
145
124
|
def _custom_all_models_for_render(
|
|
146
125
|
self, ls: LanguageServer, params: AllModelsForRenderRequest
|
|
147
126
|
) -> AllModelsForRenderResponse:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
self._ensure_context_in_folder(current_path)
|
|
151
|
-
if self.lsp_context is None:
|
|
152
|
-
raise RuntimeError("No context found")
|
|
153
|
-
return AllModelsForRenderResponse(models=self.lsp_context.list_of_models_for_rendering())
|
|
127
|
+
context = self._context_get_or_load()
|
|
128
|
+
return AllModelsForRenderResponse(models=context.list_of_models_for_rendering())
|
|
154
129
|
|
|
155
130
|
def _custom_format_project(
|
|
156
131
|
self, ls: LanguageServer, params: FormatProjectRequest
|
|
157
132
|
) -> FormatProjectResponse:
|
|
158
133
|
"""Format all models in the current project."""
|
|
159
134
|
try:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
self._ensure_context_in_folder(current_path)
|
|
163
|
-
if self.lsp_context is None:
|
|
164
|
-
raise RuntimeError("No context found")
|
|
165
|
-
|
|
166
|
-
# Call the format method on the context
|
|
167
|
-
self.lsp_context.context.format()
|
|
135
|
+
context = self._context_get_or_load()
|
|
136
|
+
context.context.format()
|
|
168
137
|
return FormatProjectResponse()
|
|
169
138
|
except Exception as e:
|
|
170
139
|
ls.log_trace(f"Error formatting project: {e}")
|
|
@@ -174,12 +143,7 @@ class SQLMeshLanguageServer:
|
|
|
174
143
|
self, ls: LanguageServer, request: ApiRequest
|
|
175
144
|
) -> t.Union[ApiResponseGetModels, ApiResponseGetColumnLineage, ApiResponseGetLineage]:
|
|
176
145
|
ls.log_trace(f"API request: {request}")
|
|
177
|
-
|
|
178
|
-
current_path = Path.cwd()
|
|
179
|
-
self._ensure_context_in_folder(current_path)
|
|
180
|
-
if self.lsp_context is None:
|
|
181
|
-
ls.log_trace("No context found in call")
|
|
182
|
-
raise RuntimeError("No context found")
|
|
146
|
+
context = self._context_get_or_load()
|
|
183
147
|
|
|
184
148
|
parsed_url = urllib.parse.urlparse(request.url)
|
|
185
149
|
path_parts = parsed_url.path.strip("/").split("/")
|
|
@@ -187,13 +151,13 @@ class SQLMeshLanguageServer:
|
|
|
187
151
|
if request.method == "GET":
|
|
188
152
|
if path_parts == ["api", "models"]:
|
|
189
153
|
# /api/models
|
|
190
|
-
return ApiResponseGetModels(data=get_models(
|
|
154
|
+
return ApiResponseGetModels(data=get_models(context.context))
|
|
191
155
|
|
|
192
156
|
if path_parts[:2] == ["api", "lineage"]:
|
|
193
157
|
if len(path_parts) == 3:
|
|
194
158
|
# /api/lineage/{model}
|
|
195
159
|
model_name = urllib.parse.unquote(path_parts[2])
|
|
196
|
-
lineage = model_lineage(model_name,
|
|
160
|
+
lineage = model_lineage(model_name, context.context)
|
|
197
161
|
non_set_lineage = {k: v for k, v in lineage.items() if v is not None}
|
|
198
162
|
return ApiResponseGetLineage(data=non_set_lineage)
|
|
199
163
|
|
|
@@ -205,7 +169,7 @@ class SQLMeshLanguageServer:
|
|
|
205
169
|
if hasattr(request, "params"):
|
|
206
170
|
models_only = bool(getattr(request.params, "models_only", False))
|
|
207
171
|
column_lineage_response = column_lineage(
|
|
208
|
-
model_name, column, models_only,
|
|
172
|
+
model_name, column, models_only, context.context
|
|
209
173
|
)
|
|
210
174
|
return ApiResponseGetColumnLineage(data=column_lineage_response)
|
|
211
175
|
|
|
@@ -280,15 +244,10 @@ class SQLMeshLanguageServer:
|
|
|
280
244
|
def did_open(ls: LanguageServer, params: types.DidOpenTextDocumentParams) -> None:
|
|
281
245
|
uri = URI(params.text_document.uri)
|
|
282
246
|
context = self._context_get_or_load(uri)
|
|
283
|
-
models = context.map[uri.to_path()]
|
|
284
|
-
if models is None or not isinstance(models, ModelTarget):
|
|
285
|
-
return
|
|
286
|
-
|
|
287
|
-
# Get diagnostics from context (which handles caching)
|
|
288
|
-
diagnostics = context.lint_model(uri)
|
|
289
247
|
|
|
290
248
|
# Only publish diagnostics if client doesn't support pull diagnostics
|
|
291
249
|
if not self.client_supports_pull_diagnostics:
|
|
250
|
+
diagnostics = context.lint_model(uri)
|
|
292
251
|
ls.publish_diagnostics(
|
|
293
252
|
params.text_document.uri,
|
|
294
253
|
SQLMeshLanguageServer._diagnostics_to_lsp_diagnostics(diagnostics),
|
|
@@ -297,22 +256,16 @@ class SQLMeshLanguageServer:
|
|
|
297
256
|
@self.server.feature(types.TEXT_DOCUMENT_DID_SAVE)
|
|
298
257
|
def did_save(ls: LanguageServer, params: types.DidSaveTextDocumentParams) -> None:
|
|
299
258
|
uri = URI(params.text_document.uri)
|
|
300
|
-
|
|
301
|
-
# Reload the entire context and create a new LSPContext
|
|
302
|
-
if self.lsp_context is not None:
|
|
303
|
-
if self._create_lsp_context(list(self.lsp_context.context.configs)):
|
|
304
|
-
return
|
|
305
|
-
|
|
306
|
-
context = self._context_get_or_load(uri)
|
|
307
|
-
models = context.map[uri.to_path()]
|
|
308
|
-
if models is None or not isinstance(models, ModelTarget):
|
|
259
|
+
if self.lsp_context is None:
|
|
309
260
|
return
|
|
310
261
|
|
|
311
|
-
|
|
312
|
-
|
|
262
|
+
context = self.lsp_context.context
|
|
263
|
+
context.load()
|
|
264
|
+
self.lsp_context = LSPContext(context)
|
|
313
265
|
|
|
314
266
|
# Only publish diagnostics if client doesn't support pull diagnostics
|
|
315
267
|
if not self.client_supports_pull_diagnostics:
|
|
268
|
+
diagnostics = self.lsp_context.lint_model(uri)
|
|
316
269
|
ls.publish_diagnostics(
|
|
317
270
|
params.text_document.uri,
|
|
318
271
|
SQLMeshLanguageServer._diagnostics_to_lsp_diagnostics(diagnostics),
|
|
@@ -325,18 +278,16 @@ class SQLMeshLanguageServer:
|
|
|
325
278
|
"""Format the document using SQLMesh `format_model_expressions`."""
|
|
326
279
|
try:
|
|
327
280
|
uri = URI(params.text_document.uri)
|
|
328
|
-
self.
|
|
281
|
+
context = self._context_get_or_load(uri)
|
|
329
282
|
document = ls.workspace.get_text_document(params.text_document.uri)
|
|
330
283
|
before = document.source
|
|
331
|
-
if self.lsp_context is None:
|
|
332
|
-
raise RuntimeError(f"No context found for document: {document.path}")
|
|
333
284
|
|
|
334
285
|
target = next(
|
|
335
286
|
(
|
|
336
287
|
target
|
|
337
288
|
for target in chain(
|
|
338
|
-
|
|
339
|
-
|
|
289
|
+
context.context._models.values(),
|
|
290
|
+
context.context._audits.values(),
|
|
340
291
|
)
|
|
341
292
|
if target._path is not None
|
|
342
293
|
and target._path.suffix == ".sql"
|
|
@@ -346,7 +297,7 @@ class SQLMeshLanguageServer:
|
|
|
346
297
|
)
|
|
347
298
|
if target is None:
|
|
348
299
|
return []
|
|
349
|
-
after =
|
|
300
|
+
after = context.context._format(
|
|
350
301
|
target=target,
|
|
351
302
|
before=before,
|
|
352
303
|
)
|
|
@@ -371,12 +322,10 @@ class SQLMeshLanguageServer:
|
|
|
371
322
|
"""Provide hover information for an object."""
|
|
372
323
|
try:
|
|
373
324
|
uri = URI(params.text_document.uri)
|
|
374
|
-
self.
|
|
325
|
+
context = self._context_get_or_load(uri)
|
|
375
326
|
document = ls.workspace.get_text_document(params.text_document.uri)
|
|
376
|
-
if self.lsp_context is None:
|
|
377
|
-
raise RuntimeError(f"No context found for document: {document.path}")
|
|
378
327
|
|
|
379
|
-
references = get_references(
|
|
328
|
+
references = get_references(context, uri, params.position)
|
|
380
329
|
if not references:
|
|
381
330
|
return None
|
|
382
331
|
reference = references[0]
|
|
@@ -403,13 +352,11 @@ class SQLMeshLanguageServer:
|
|
|
403
352
|
"""Implement type hints for sql columns as inlay hints"""
|
|
404
353
|
try:
|
|
405
354
|
uri = URI(params.text_document.uri)
|
|
406
|
-
self.
|
|
407
|
-
if self.lsp_context is None:
|
|
408
|
-
raise RuntimeError(f"No context found for document: {uri}")
|
|
355
|
+
context = self._context_get_or_load(uri)
|
|
409
356
|
|
|
410
357
|
start_line = params.range.start.line
|
|
411
358
|
end_line = params.range.end.line
|
|
412
|
-
hints = get_hints(
|
|
359
|
+
hints = get_hints(context, uri, start_line, end_line)
|
|
413
360
|
return hints
|
|
414
361
|
|
|
415
362
|
except Exception as e:
|
|
@@ -422,12 +369,9 @@ class SQLMeshLanguageServer:
|
|
|
422
369
|
"""Jump to an object's definition."""
|
|
423
370
|
try:
|
|
424
371
|
uri = URI(params.text_document.uri)
|
|
425
|
-
self.
|
|
426
|
-
document = ls.workspace.get_text_document(params.text_document.uri)
|
|
427
|
-
if self.lsp_context is None:
|
|
428
|
-
raise RuntimeError(f"No context found for document: {document.path}")
|
|
372
|
+
context = self._context_get_or_load(uri)
|
|
429
373
|
|
|
430
|
-
references = get_references(
|
|
374
|
+
references = get_references(context, uri, params.position)
|
|
431
375
|
location_links = []
|
|
432
376
|
for reference in references:
|
|
433
377
|
# Use target_range if available (CTEs, Macros, and external models in YAML)
|
|
@@ -479,12 +423,9 @@ class SQLMeshLanguageServer:
|
|
|
479
423
|
"""Find all references of a symbol (supporting CTEs, models for now)"""
|
|
480
424
|
try:
|
|
481
425
|
uri = URI(params.text_document.uri)
|
|
482
|
-
self.
|
|
483
|
-
document = ls.workspace.get_text_document(params.text_document.uri)
|
|
484
|
-
if self.lsp_context is None:
|
|
485
|
-
raise RuntimeError(f"No context found for document: {document.path}")
|
|
426
|
+
context = self._context_get_or_load(uri)
|
|
486
427
|
|
|
487
|
-
all_references = get_all_references(
|
|
428
|
+
all_references = get_all_references(context, uri, params.position)
|
|
488
429
|
|
|
489
430
|
# Convert references to Location objects
|
|
490
431
|
locations = [types.Location(uri=ref.uri, range=ref.range) for ref in all_references]
|
|
@@ -531,12 +472,7 @@ class SQLMeshLanguageServer:
|
|
|
531
472
|
) -> types.WorkspaceDiagnosticReport:
|
|
532
473
|
"""Handle workspace-wide diagnostic pull requests from the client."""
|
|
533
474
|
try:
|
|
534
|
-
|
|
535
|
-
current_path = Path.cwd()
|
|
536
|
-
self._ensure_context_in_folder(current_path)
|
|
537
|
-
|
|
538
|
-
if self.lsp_context is None:
|
|
539
|
-
return types.WorkspaceDiagnosticReport(items=[])
|
|
475
|
+
context = self._context_get_or_load()
|
|
540
476
|
|
|
541
477
|
items: t.List[
|
|
542
478
|
t.Union[
|
|
@@ -546,7 +482,7 @@ class SQLMeshLanguageServer:
|
|
|
546
482
|
] = []
|
|
547
483
|
|
|
548
484
|
# Get all SQL and Python model files from the context
|
|
549
|
-
for path, target in
|
|
485
|
+
for path, target in context.map.items():
|
|
550
486
|
if isinstance(target, ModelTarget):
|
|
551
487
|
uri = URI.from_path(path)
|
|
552
488
|
diagnostics, result_id = self._get_diagnostics_for_uri(uri)
|
|
@@ -679,79 +615,94 @@ class SQLMeshLanguageServer:
|
|
|
679
615
|
except Exception:
|
|
680
616
|
return [], 0
|
|
681
617
|
|
|
682
|
-
def _context_get_or_load(self, document_uri: URI) -> LSPContext:
|
|
618
|
+
def _context_get_or_load(self, document_uri: t.Optional[URI] = None) -> LSPContext:
|
|
683
619
|
if self.lsp_context is None:
|
|
684
620
|
self._ensure_context_for_document(document_uri)
|
|
685
621
|
if self.lsp_context is None:
|
|
686
|
-
raise RuntimeError("No context found")
|
|
622
|
+
raise RuntimeError("No context found able to get or load")
|
|
687
623
|
return self.lsp_context
|
|
688
624
|
|
|
689
|
-
def _ensure_context_in_folder(self, folder_uri: Path) -> None:
|
|
690
|
-
if self.lsp_context is not None:
|
|
691
|
-
return
|
|
692
|
-
|
|
693
|
-
# First, check the provided folder
|
|
694
|
-
for ext in ("py", "yml", "yaml"):
|
|
695
|
-
config_path = folder_uri / f"config.{ext}"
|
|
696
|
-
if config_path.exists():
|
|
697
|
-
if self._create_lsp_context([folder_uri]):
|
|
698
|
-
loaded_sqlmesh_message(self.server, folder_uri)
|
|
699
|
-
return
|
|
700
|
-
|
|
701
|
-
# If not found in the provided folder, search through all workspace folders
|
|
702
|
-
for workspace_folder in self.workspace_folders:
|
|
703
|
-
for ext in ("py", "yml", "yaml"):
|
|
704
|
-
config_path = workspace_folder / f"config.{ext}"
|
|
705
|
-
if config_path.exists():
|
|
706
|
-
if self._create_lsp_context([workspace_folder]):
|
|
707
|
-
loaded_sqlmesh_message(self.server, workspace_folder)
|
|
708
|
-
return
|
|
709
|
-
|
|
710
625
|
def _ensure_context_for_document(
|
|
711
626
|
self,
|
|
712
|
-
document_uri: URI,
|
|
627
|
+
document_uri: t.Optional[URI] = None,
|
|
713
628
|
) -> None:
|
|
714
629
|
"""
|
|
715
630
|
Ensure that a context exists for the given document if applicable by searching
|
|
716
631
|
for a config.py or config.yml file in the parent directories.
|
|
717
632
|
"""
|
|
633
|
+
if document_uri is not None:
|
|
634
|
+
document_path = document_uri.to_path()
|
|
635
|
+
if document_path.is_file() and document_path.suffix in (".sql", ".py"):
|
|
636
|
+
document_folder = document_path.parent
|
|
637
|
+
if document_folder.is_dir():
|
|
638
|
+
self._ensure_context_in_folder(document_folder)
|
|
639
|
+
return
|
|
640
|
+
|
|
641
|
+
return self._ensure_context_in_folder()
|
|
642
|
+
|
|
643
|
+
def _ensure_context_in_folder(self, folder_path: t.Optional[Path] = None) -> None:
|
|
718
644
|
if self.lsp_context is not None:
|
|
719
|
-
self.lsp_context.context.load()
|
|
720
|
-
self.lsp_context = LSPContext(self.lsp_context.context)
|
|
721
645
|
return
|
|
722
646
|
|
|
723
|
-
#
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
647
|
+
# If not found in the provided folder, search through all workspace folders
|
|
648
|
+
for workspace_folder in self.workspace_folders:
|
|
649
|
+
for ext in ("py", "yml", "yaml"):
|
|
650
|
+
config_path = workspace_folder / f"config.{ext}"
|
|
651
|
+
if config_path.exists():
|
|
652
|
+
if self._create_lsp_context([workspace_folder]):
|
|
653
|
+
return
|
|
727
654
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
655
|
+
# Then , check the provided folder recursively
|
|
656
|
+
path = folder_path
|
|
657
|
+
if path is None:
|
|
658
|
+
path = Path.cwd()
|
|
659
|
+
while path.is_dir():
|
|
732
660
|
for ext in ("py", "yml", "yaml"):
|
|
733
|
-
config_path =
|
|
661
|
+
config_path = path / f"config.{ext}"
|
|
734
662
|
if config_path.exists():
|
|
735
|
-
if self._create_lsp_context([
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
if current_dir == current_dir.parent:
|
|
663
|
+
if self._create_lsp_context([path]):
|
|
664
|
+
return
|
|
665
|
+
|
|
666
|
+
path = path.parent
|
|
667
|
+
if path == path.parent:
|
|
741
668
|
break
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
669
|
+
|
|
670
|
+
raise RuntimeError(
|
|
671
|
+
f"No context found in workspaces folders {self.workspace_folders}"
|
|
672
|
+
+ (f" or in {folder_path}" if folder_path else "")
|
|
673
|
+
)
|
|
674
|
+
|
|
675
|
+
def _create_lsp_context(self, paths: t.List[Path]) -> t.Optional[LSPContext]:
|
|
676
|
+
"""Create a new LSPContext instance using the configured context class.
|
|
677
|
+
|
|
678
|
+
On success, sets self.lsp_context and returns the created context.
|
|
679
|
+
|
|
680
|
+
Args:
|
|
681
|
+
paths: List of paths to pass to the context constructor
|
|
682
|
+
|
|
683
|
+
Returns:
|
|
684
|
+
A new LSPContext instance wrapping the created context, or None if creation fails
|
|
685
|
+
"""
|
|
686
|
+
try:
|
|
687
|
+
if self.lsp_context is None:
|
|
688
|
+
context = self.context_class(paths=paths)
|
|
689
|
+
loaded_sqlmesh_message(self.server, paths[0])
|
|
690
|
+
else:
|
|
691
|
+
self.lsp_context.context.load()
|
|
692
|
+
context = self.lsp_context.context
|
|
693
|
+
self.lsp_context = LSPContext(context)
|
|
694
|
+
return self.lsp_context
|
|
695
|
+
except Exception as e:
|
|
696
|
+
# Only show the error message once
|
|
697
|
+
if not self.has_raised_loading_error:
|
|
698
|
+
self.server.show_message(
|
|
699
|
+
f"Error creating context: {e}",
|
|
700
|
+
types.MessageType.Error,
|
|
701
|
+
)
|
|
702
|
+
self.has_raised_loading_error = True
|
|
703
|
+
|
|
704
|
+
self.server.log_trace(f"Error creating context: {e}")
|
|
705
|
+
return None
|
|
755
706
|
|
|
756
707
|
@staticmethod
|
|
757
708
|
def _diagnostic_to_lsp_diagnostic(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
sqlmesh/__init__.py,sha256=QjwaamJIdW7voXoS880yAx7tHm-Im4_mqGA-XJgafos,7631
|
|
2
|
-
sqlmesh/_version.py,sha256=
|
|
2
|
+
sqlmesh/_version.py,sha256=qFwwdd4wVG_5RGU1DfQtmeamvZVGygz1OJ3c2pGaAKI,528
|
|
3
3
|
sqlmesh/magics.py,sha256=ysPC5ohXpgQ8IHQPwtQtwGoVypmVq_YBlm1noUueDIw,40448
|
|
4
4
|
sqlmesh/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
sqlmesh/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -97,8 +97,8 @@ sqlmesh/core/plan/__init__.py,sha256=NKSvM7ZBVjw9ho3J65M1wFvG3KURB8PJ0FHHLmtSF44
|
|
|
97
97
|
sqlmesh/core/plan/builder.py,sha256=OS6igFQvPRLwIxuYT4WYcuWnuSrPfCQArUA6ohxFnZw,41341
|
|
98
98
|
sqlmesh/core/plan/definition.py,sha256=-jAO5EWvZdmn8jU7bMFJcprBPdfTVhSRgAvBPZ6kqBg,13613
|
|
99
99
|
sqlmesh/core/plan/evaluator.py,sha256=w3sZJFRc94kZ2d3s4rRir2sSugtngPQ3uIIFU77y-jY,20157
|
|
100
|
-
sqlmesh/core/plan/explainer.py,sha256=
|
|
101
|
-
sqlmesh/core/plan/stages.py,sha256=
|
|
100
|
+
sqlmesh/core/plan/explainer.py,sha256=SD7L41x-E_s4Cvf37wbP_-pdCrxdUkfsRKbFRIvVPG0,11826
|
|
101
|
+
sqlmesh/core/plan/stages.py,sha256=9BtcCgHYSvELrAkrOEhTuR1POAJNknLn_n4CmkqAC-4,21869
|
|
102
102
|
sqlmesh/core/snapshot/__init__.py,sha256=Z5HTetNCZGoKF1WAKXk4LWL9dc8EC8lwS2O4TtoBmt4,1317
|
|
103
103
|
sqlmesh/core/snapshot/cache.py,sha256=bgqCR2hyf6r2A_8QP1EnXFK25gDX37-Zg0YeMuETWxg,3934
|
|
104
104
|
sqlmesh/core/snapshot/categorizer.py,sha256=qGG5870mu1jR2whKisSBH_GFbsyh96RnzJDgkN7DV9g,2482
|
|
@@ -172,7 +172,7 @@ sqlmesh/lsp/custom.py,sha256=IJ70li8d5RbOFDrjHfsI2UNOiOp-WB22lrgpdJ7lVSg,2942
|
|
|
172
172
|
sqlmesh/lsp/description.py,sha256=PjguwyVw5YeYSgT0JMhkf5U1Jry-sDPLvQ2caIR9JPQ,856
|
|
173
173
|
sqlmesh/lsp/helpers.py,sha256=EFc1u3-b7kSv5-tNwmKUDxId72RCLDBnN2lLTgRSzzQ,1020
|
|
174
174
|
sqlmesh/lsp/hints.py,sha256=j-blccBUil94yRoDjWfkSM0HqMmsKD6hP2TaWdWWVk4,3734
|
|
175
|
-
sqlmesh/lsp/main.py,sha256=
|
|
175
|
+
sqlmesh/lsp/main.py,sha256=EanNAS5ArBRc2oYsS3jhL46pfzXLn78xwSW-9R4RQ3o,33731
|
|
176
176
|
sqlmesh/lsp/reference.py,sha256=8hZT3wH8zmWiFEySS1_nVhhLg-CKCGncf9wG3LGBef8,26432
|
|
177
177
|
sqlmesh/lsp/uri.py,sha256=mvSLbZGmMTHPpliThOtVWiFcHnfJzp1w39q9l-xD2SI,802
|
|
178
178
|
sqlmesh/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -282,7 +282,7 @@ sqlmesh/utils/pydantic.py,sha256=I898jAFqa3qU6lG2uPpRebVFncOUo8ZrLWM_R3K3DHU,116
|
|
|
282
282
|
sqlmesh/utils/rich.py,sha256=BpB47G0-JcU41LkGkeGKroexj4NOV5fox4-GOIXPgIc,3545
|
|
283
283
|
sqlmesh/utils/windows.py,sha256=r7Yin4WEwbvH7sKA3hOJtRsclmscNuBeCklCfVPvtQs,611
|
|
284
284
|
sqlmesh/utils/yaml.py,sha256=np-WVcwmwsKghCgAj1OBBMsK1SXSRn4wR-H37cGiFr8,2282
|
|
285
|
-
sqlmesh-0.193.1.
|
|
285
|
+
sqlmesh-0.193.1.dev9.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
|
|
286
286
|
web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
287
287
|
web/client/dist/index.html,sha256=6S_GSRtPwXyr17YSqAWyZ2Prb2puyUa-UdLiZpFtwe4,5472
|
|
288
288
|
web/client/dist/assets/Audits-Dym5PKHr.js,sha256=UZFlxjPaLxv7b4C494dCxXDNY7918lWEkn2FghwDd4E,1041
|
|
@@ -400,8 +400,8 @@ web/server/api/endpoints/models.py,sha256=ud-lRwriyI_OYg9tZchrBgeiXELiRTLNEodraf
|
|
|
400
400
|
web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
|
|
401
401
|
web/server/api/endpoints/plan.py,sha256=OYuQ_4dgbhG9ibTcX1a8mvYgH3ANxw9Fhbb4wg6QWqc,9222
|
|
402
402
|
web/server/api/endpoints/table_diff.py,sha256=SCy3-pr5x6bEEiOaZGCDbiHQhpgxwmnz3Acqa2Ie6jI,2090
|
|
403
|
-
sqlmesh-0.193.1.
|
|
404
|
-
sqlmesh-0.193.1.
|
|
405
|
-
sqlmesh-0.193.1.
|
|
406
|
-
sqlmesh-0.193.1.
|
|
407
|
-
sqlmesh-0.193.1.
|
|
403
|
+
sqlmesh-0.193.1.dev9.dist-info/METADATA,sha256=1_fQ4I8zsSD5GCubI2ZpmHY0FW9cC9LZJXrW-1ME-Nc,26690
|
|
404
|
+
sqlmesh-0.193.1.dev9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
405
|
+
sqlmesh-0.193.1.dev9.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
|
|
406
|
+
sqlmesh-0.193.1.dev9.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
|
|
407
|
+
sqlmesh-0.193.1.dev9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|