sqlmesh 0.189.3.dev27__py3-none-any.whl → 0.189.3.dev28__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/lsp/api.py +12 -5
- sqlmesh/lsp/custom.py +19 -9
- sqlmesh/lsp/main.py +137 -124
- {sqlmesh-0.189.3.dev27.dist-info → sqlmesh-0.189.3.dev28.dist-info}/METADATA +1 -1
- {sqlmesh-0.189.3.dev27.dist-info → sqlmesh-0.189.3.dev28.dist-info}/RECORD +10 -10
- {sqlmesh-0.189.3.dev27.dist-info → sqlmesh-0.189.3.dev28.dist-info}/WHEEL +0 -0
- {sqlmesh-0.189.3.dev27.dist-info → sqlmesh-0.189.3.dev28.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.189.3.dev27.dist-info → sqlmesh-0.189.3.dev28.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.189.3.dev27.dist-info → sqlmesh-0.189.3.dev28.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.189.3.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 189, 3, '
|
|
20
|
+
__version__ = version = '0.189.3.dev28'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 189, 3, 'dev28')
|
sqlmesh/lsp/api.py
CHANGED
|
@@ -9,13 +9,16 @@ separate process for the web api.
|
|
|
9
9
|
|
|
10
10
|
import typing as t
|
|
11
11
|
from pydantic import field_validator
|
|
12
|
-
from sqlmesh.
|
|
12
|
+
from sqlmesh.lsp.custom import (
|
|
13
|
+
CustomMethodRequestBaseClass,
|
|
14
|
+
CustomMethodResponseBaseClass,
|
|
15
|
+
)
|
|
13
16
|
from web.server.models import LineageColumn, Model
|
|
14
17
|
|
|
15
18
|
API_FEATURE = "sqlmesh/api"
|
|
16
19
|
|
|
17
20
|
|
|
18
|
-
class ApiRequest(
|
|
21
|
+
class ApiRequest(CustomMethodRequestBaseClass):
|
|
19
22
|
"""
|
|
20
23
|
Request to call the SQLMesh API.
|
|
21
24
|
This is a generic request that can be used to call any API endpoint.
|
|
@@ -28,7 +31,11 @@ class ApiRequest(PydanticModel):
|
|
|
28
31
|
body: t.Optional[t.Dict[str, t.Any]] = None
|
|
29
32
|
|
|
30
33
|
|
|
31
|
-
class
|
|
34
|
+
class BaseAPIResponse(CustomMethodResponseBaseClass):
|
|
35
|
+
error: t.Optional[str] = None
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class ApiResponseGetModels(BaseAPIResponse):
|
|
32
39
|
"""
|
|
33
40
|
Response from the SQLMesh API for the get_models endpoint.
|
|
34
41
|
"""
|
|
@@ -53,7 +60,7 @@ class ApiResponseGetModels(PydanticModel):
|
|
|
53
60
|
return data
|
|
54
61
|
|
|
55
62
|
|
|
56
|
-
class ApiResponseGetLineage(
|
|
63
|
+
class ApiResponseGetLineage(BaseAPIResponse):
|
|
57
64
|
"""
|
|
58
65
|
Response from the SQLMesh API for the get_lineage endpoint.
|
|
59
66
|
"""
|
|
@@ -61,7 +68,7 @@ class ApiResponseGetLineage(PydanticModel):
|
|
|
61
68
|
data: t.Dict[str, t.List[str]]
|
|
62
69
|
|
|
63
70
|
|
|
64
|
-
class ApiResponseGetColumnLineage(
|
|
71
|
+
class ApiResponseGetColumnLineage(BaseAPIResponse):
|
|
65
72
|
"""
|
|
66
73
|
Response from the SQLMesh API for the get_column_lineage endpoint.
|
|
67
74
|
"""
|
sqlmesh/lsp/custom.py
CHANGED
|
@@ -2,10 +2,20 @@ from lsprotocol import types
|
|
|
2
2
|
import typing as t
|
|
3
3
|
from sqlmesh.utils.pydantic import PydanticModel
|
|
4
4
|
|
|
5
|
+
|
|
6
|
+
class CustomMethodRequestBaseClass(PydanticModel):
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CustomMethodResponseBaseClass(PydanticModel):
|
|
11
|
+
# Prefixing, so guaranteed not to collide
|
|
12
|
+
response_error: t.Optional[str] = None
|
|
13
|
+
|
|
14
|
+
|
|
5
15
|
ALL_MODELS_FEATURE = "sqlmesh/all_models"
|
|
6
16
|
|
|
7
17
|
|
|
8
|
-
class AllModelsRequest(
|
|
18
|
+
class AllModelsRequest(CustomMethodRequestBaseClass):
|
|
9
19
|
"""
|
|
10
20
|
Request to get all the models that are in the current project.
|
|
11
21
|
"""
|
|
@@ -13,7 +23,7 @@ class AllModelsRequest(PydanticModel):
|
|
|
13
23
|
textDocument: types.TextDocumentIdentifier
|
|
14
24
|
|
|
15
25
|
|
|
16
|
-
class AllModelsResponse(
|
|
26
|
+
class AllModelsResponse(CustomMethodResponseBaseClass):
|
|
17
27
|
"""
|
|
18
28
|
Response to get all the models that are in the current project.
|
|
19
29
|
"""
|
|
@@ -26,7 +36,7 @@ class AllModelsResponse(PydanticModel):
|
|
|
26
36
|
RENDER_MODEL_FEATURE = "sqlmesh/render_model"
|
|
27
37
|
|
|
28
38
|
|
|
29
|
-
class RenderModelRequest(
|
|
39
|
+
class RenderModelRequest(CustomMethodRequestBaseClass):
|
|
30
40
|
textDocumentUri: str
|
|
31
41
|
|
|
32
42
|
|
|
@@ -41,7 +51,7 @@ class RenderModelEntry(PydanticModel):
|
|
|
41
51
|
rendered_query: str
|
|
42
52
|
|
|
43
53
|
|
|
44
|
-
class RenderModelResponse(
|
|
54
|
+
class RenderModelResponse(CustomMethodResponseBaseClass):
|
|
45
55
|
"""
|
|
46
56
|
Response to render a model.
|
|
47
57
|
"""
|
|
@@ -63,11 +73,11 @@ class ModelForRendering(PydanticModel):
|
|
|
63
73
|
uri: str
|
|
64
74
|
|
|
65
75
|
|
|
66
|
-
class AllModelsForRenderRequest(
|
|
76
|
+
class AllModelsForRenderRequest(CustomMethodRequestBaseClass):
|
|
67
77
|
pass
|
|
68
78
|
|
|
69
79
|
|
|
70
|
-
class AllModelsForRenderResponse(
|
|
80
|
+
class AllModelsForRenderResponse(CustomMethodResponseBaseClass):
|
|
71
81
|
"""
|
|
72
82
|
Response to get all the models that are in the current project for rendering purposes.
|
|
73
83
|
"""
|
|
@@ -94,7 +104,7 @@ class CustomMethod(PydanticModel):
|
|
|
94
104
|
name: str
|
|
95
105
|
|
|
96
106
|
|
|
97
|
-
class SupportedMethodsResponse(
|
|
107
|
+
class SupportedMethodsResponse(CustomMethodResponseBaseClass):
|
|
98
108
|
"""
|
|
99
109
|
Response containing all supported custom LSP methods.
|
|
100
110
|
"""
|
|
@@ -105,7 +115,7 @@ class SupportedMethodsResponse(PydanticModel):
|
|
|
105
115
|
FORMAT_PROJECT_FEATURE = "sqlmesh/format_project"
|
|
106
116
|
|
|
107
117
|
|
|
108
|
-
class FormatProjectRequest(
|
|
118
|
+
class FormatProjectRequest(CustomMethodRequestBaseClass):
|
|
109
119
|
"""
|
|
110
120
|
Request to format all models in the current project.
|
|
111
121
|
"""
|
|
@@ -113,7 +123,7 @@ class FormatProjectRequest(PydanticModel):
|
|
|
113
123
|
pass
|
|
114
124
|
|
|
115
125
|
|
|
116
|
-
class FormatProjectResponse(
|
|
126
|
+
class FormatProjectResponse(CustomMethodResponseBaseClass):
|
|
117
127
|
"""
|
|
118
128
|
Response to format project request.
|
|
119
129
|
"""
|
sqlmesh/lsp/main.py
CHANGED
|
@@ -35,6 +35,7 @@ from sqlmesh.lsp.custom import (
|
|
|
35
35
|
AllModelsResponse,
|
|
36
36
|
AllModelsForRenderRequest,
|
|
37
37
|
AllModelsForRenderResponse,
|
|
38
|
+
CustomMethodResponseBaseClass,
|
|
38
39
|
RenderModelRequest,
|
|
39
40
|
RenderModelResponse,
|
|
40
41
|
SupportedMethodsRequest,
|
|
@@ -54,15 +55,6 @@ from sqlmesh.lsp.uri import URI
|
|
|
54
55
|
from web.server.api.endpoints.lineage import column_lineage, model_lineage
|
|
55
56
|
from web.server.api.endpoints.models import get_models
|
|
56
57
|
|
|
57
|
-
SUPPORTED_CUSTOM_METHODS = [
|
|
58
|
-
ALL_MODELS_FEATURE,
|
|
59
|
-
RENDER_MODEL_FEATURE,
|
|
60
|
-
ALL_MODELS_FOR_RENDER_FEATURE,
|
|
61
|
-
API_FEATURE,
|
|
62
|
-
SUPPORTED_METHODS_FEATURE,
|
|
63
|
-
FORMAT_PROJECT_FEATURE,
|
|
64
|
-
]
|
|
65
|
-
|
|
66
58
|
|
|
67
59
|
class SQLMeshLanguageServer:
|
|
68
60
|
def __init__(
|
|
@@ -82,6 +74,22 @@ class SQLMeshLanguageServer:
|
|
|
82
74
|
self.workspace_folders: t.List[Path] = []
|
|
83
75
|
|
|
84
76
|
self.client_supports_pull_diagnostics = False
|
|
77
|
+
self._supported_custom_methods: t.Dict[
|
|
78
|
+
str,
|
|
79
|
+
t.Callable[
|
|
80
|
+
# mypy unable to recognise the base class
|
|
81
|
+
[LanguageServer, t.Any],
|
|
82
|
+
t.Any,
|
|
83
|
+
],
|
|
84
|
+
] = {
|
|
85
|
+
ALL_MODELS_FEATURE: self._custom_all_models,
|
|
86
|
+
RENDER_MODEL_FEATURE: self._custom_render_model,
|
|
87
|
+
ALL_MODELS_FOR_RENDER_FEATURE: self._custom_all_models_for_render,
|
|
88
|
+
API_FEATURE: self._custom_api,
|
|
89
|
+
SUPPORTED_METHODS_FEATURE: self._custom_supported_methods,
|
|
90
|
+
FORMAT_PROJECT_FEATURE: self._custom_format_project,
|
|
91
|
+
}
|
|
92
|
+
|
|
85
93
|
# Register LSP features (e.g., formatting, hover, etc.)
|
|
86
94
|
self._register_features()
|
|
87
95
|
|
|
@@ -105,8 +113,128 @@ class SQLMeshLanguageServer:
|
|
|
105
113
|
self.server.log_trace(f"Error creating context: {e}")
|
|
106
114
|
return None
|
|
107
115
|
|
|
116
|
+
# All the custom LSP methods are registered here and prefixed with _custom
|
|
117
|
+
def _custom_all_models(self, ls: LanguageServer, params: AllModelsRequest) -> AllModelsResponse:
|
|
118
|
+
uri = URI(params.textDocument.uri)
|
|
119
|
+
# Get the document content
|
|
120
|
+
content = None
|
|
121
|
+
try:
|
|
122
|
+
document = ls.workspace.get_text_document(params.textDocument.uri)
|
|
123
|
+
content = document.source
|
|
124
|
+
except Exception:
|
|
125
|
+
pass
|
|
126
|
+
try:
|
|
127
|
+
context = self._context_get_or_load(uri)
|
|
128
|
+
return LSPContext.get_completions(context, uri, content)
|
|
129
|
+
except Exception as e:
|
|
130
|
+
from sqlmesh.lsp.completions import get_sql_completions
|
|
131
|
+
|
|
132
|
+
return get_sql_completions(None, URI(params.textDocument.uri), content)
|
|
133
|
+
|
|
134
|
+
def _custom_render_model(
|
|
135
|
+
self, ls: LanguageServer, params: RenderModelRequest
|
|
136
|
+
) -> RenderModelResponse:
|
|
137
|
+
uri = URI(params.textDocumentUri)
|
|
138
|
+
context = self._context_get_or_load(uri)
|
|
139
|
+
return RenderModelResponse(models=context.render_model(uri))
|
|
140
|
+
|
|
141
|
+
def _custom_all_models_for_render(
|
|
142
|
+
self, ls: LanguageServer, params: AllModelsForRenderRequest
|
|
143
|
+
) -> AllModelsForRenderResponse:
|
|
144
|
+
if self.lsp_context is None:
|
|
145
|
+
current_path = Path.cwd()
|
|
146
|
+
self._ensure_context_in_folder(current_path)
|
|
147
|
+
if self.lsp_context is None:
|
|
148
|
+
raise RuntimeError("No context found")
|
|
149
|
+
return AllModelsForRenderResponse(models=self.lsp_context.list_of_models_for_rendering())
|
|
150
|
+
|
|
151
|
+
def _custom_format_project(
|
|
152
|
+
self, ls: LanguageServer, params: FormatProjectRequest
|
|
153
|
+
) -> FormatProjectResponse:
|
|
154
|
+
"""Format all models in the current project."""
|
|
155
|
+
try:
|
|
156
|
+
if self.lsp_context is None:
|
|
157
|
+
current_path = Path.cwd()
|
|
158
|
+
self._ensure_context_in_folder(current_path)
|
|
159
|
+
if self.lsp_context is None:
|
|
160
|
+
raise RuntimeError("No context found")
|
|
161
|
+
|
|
162
|
+
# Call the format method on the context
|
|
163
|
+
self.lsp_context.context.format()
|
|
164
|
+
return FormatProjectResponse()
|
|
165
|
+
except Exception as e:
|
|
166
|
+
ls.log_trace(f"Error formatting project: {e}")
|
|
167
|
+
return FormatProjectResponse()
|
|
168
|
+
|
|
169
|
+
def _custom_api(
|
|
170
|
+
self, ls: LanguageServer, request: ApiRequest
|
|
171
|
+
) -> t.Union[ApiResponseGetModels, ApiResponseGetColumnLineage, ApiResponseGetLineage]:
|
|
172
|
+
ls.log_trace(f"API request: {request}")
|
|
173
|
+
if self.lsp_context is None:
|
|
174
|
+
current_path = Path.cwd()
|
|
175
|
+
self._ensure_context_in_folder(current_path)
|
|
176
|
+
if self.lsp_context is None:
|
|
177
|
+
ls.log_trace("No context found in call")
|
|
178
|
+
raise RuntimeError("No context found")
|
|
179
|
+
|
|
180
|
+
parsed_url = urllib.parse.urlparse(request.url)
|
|
181
|
+
path_parts = parsed_url.path.strip("/").split("/")
|
|
182
|
+
|
|
183
|
+
if request.method == "GET":
|
|
184
|
+
if path_parts == ["api", "models"]:
|
|
185
|
+
# /api/models
|
|
186
|
+
return ApiResponseGetModels(data=get_models(self.lsp_context.context))
|
|
187
|
+
|
|
188
|
+
if path_parts[:2] == ["api", "lineage"]:
|
|
189
|
+
if len(path_parts) == 3:
|
|
190
|
+
# /api/lineage/{model}
|
|
191
|
+
model_name = urllib.parse.unquote(path_parts[2])
|
|
192
|
+
lineage = model_lineage(model_name, self.lsp_context.context)
|
|
193
|
+
non_set_lineage = {k: v for k, v in lineage.items() if v is not None}
|
|
194
|
+
return ApiResponseGetLineage(data=non_set_lineage)
|
|
195
|
+
|
|
196
|
+
if len(path_parts) == 4:
|
|
197
|
+
# /api/lineage/{model}/{column}
|
|
198
|
+
model_name = urllib.parse.unquote(path_parts[2])
|
|
199
|
+
column = urllib.parse.unquote(path_parts[3])
|
|
200
|
+
models_only = False
|
|
201
|
+
if hasattr(request, "params"):
|
|
202
|
+
models_only = bool(getattr(request.params, "models_only", False))
|
|
203
|
+
column_lineage_response = column_lineage(
|
|
204
|
+
model_name, column, models_only, self.lsp_context.context
|
|
205
|
+
)
|
|
206
|
+
return ApiResponseGetColumnLineage(data=column_lineage_response)
|
|
207
|
+
|
|
208
|
+
raise NotImplementedError(f"API request not implemented: {request.url}")
|
|
209
|
+
|
|
210
|
+
def _custom_supported_methods(
|
|
211
|
+
self, ls: LanguageServer, params: SupportedMethodsRequest
|
|
212
|
+
) -> SupportedMethodsResponse:
|
|
213
|
+
"""Return all supported custom LSP methods."""
|
|
214
|
+
return SupportedMethodsResponse(
|
|
215
|
+
methods=[
|
|
216
|
+
CustomMethod(
|
|
217
|
+
name=name,
|
|
218
|
+
)
|
|
219
|
+
for name in self._supported_custom_methods
|
|
220
|
+
]
|
|
221
|
+
)
|
|
222
|
+
|
|
108
223
|
def _register_features(self) -> None:
|
|
109
224
|
"""Register LSP features on the internal LanguageServer instance."""
|
|
225
|
+
for name, method in self._supported_custom_methods.items():
|
|
226
|
+
|
|
227
|
+
def create_function_call(method_func: t.Callable) -> t.Callable:
|
|
228
|
+
def function_call(ls: LanguageServer, params: t.Any) -> t.Dict[str, t.Any]:
|
|
229
|
+
try:
|
|
230
|
+
response = method_func(ls, params)
|
|
231
|
+
except Exception as e:
|
|
232
|
+
response = CustomMethodResponseBaseClass(response_error=str(e))
|
|
233
|
+
return response.model_dump(mode="json")
|
|
234
|
+
|
|
235
|
+
return function_call
|
|
236
|
+
|
|
237
|
+
self.server.feature(name)(create_function_call(method))
|
|
110
238
|
|
|
111
239
|
@self.server.feature(types.INITIALIZE)
|
|
112
240
|
def initialize(ls: LanguageServer, params: types.InitializeParams) -> None:
|
|
@@ -144,121 +272,6 @@ class SQLMeshLanguageServer:
|
|
|
144
272
|
f"Error initializing SQLMesh context: {e}",
|
|
145
273
|
)
|
|
146
274
|
|
|
147
|
-
@self.server.feature(ALL_MODELS_FEATURE)
|
|
148
|
-
def all_models(ls: LanguageServer, params: AllModelsRequest) -> AllModelsResponse:
|
|
149
|
-
uri = URI(params.textDocument.uri)
|
|
150
|
-
|
|
151
|
-
# Get the document content
|
|
152
|
-
content = None
|
|
153
|
-
try:
|
|
154
|
-
document = ls.workspace.get_text_document(params.textDocument.uri)
|
|
155
|
-
content = document.source
|
|
156
|
-
except Exception:
|
|
157
|
-
pass
|
|
158
|
-
|
|
159
|
-
try:
|
|
160
|
-
context = self._context_get_or_load(uri)
|
|
161
|
-
return LSPContext.get_completions(context, uri, content)
|
|
162
|
-
except Exception as e:
|
|
163
|
-
from sqlmesh.lsp.completions import get_sql_completions
|
|
164
|
-
|
|
165
|
-
return get_sql_completions(None, URI(params.textDocument.uri), content)
|
|
166
|
-
|
|
167
|
-
@self.server.feature(RENDER_MODEL_FEATURE)
|
|
168
|
-
def render_model(ls: LanguageServer, params: RenderModelRequest) -> RenderModelResponse:
|
|
169
|
-
uri = URI(params.textDocumentUri)
|
|
170
|
-
context = self._context_get_or_load(uri)
|
|
171
|
-
return RenderModelResponse(models=context.render_model(uri))
|
|
172
|
-
|
|
173
|
-
@self.server.feature(ALL_MODELS_FOR_RENDER_FEATURE)
|
|
174
|
-
def all_models_for_render(
|
|
175
|
-
ls: LanguageServer, params: AllModelsForRenderRequest
|
|
176
|
-
) -> AllModelsForRenderResponse:
|
|
177
|
-
if self.lsp_context is None:
|
|
178
|
-
current_path = Path.cwd()
|
|
179
|
-
self._ensure_context_in_folder(current_path)
|
|
180
|
-
if self.lsp_context is None:
|
|
181
|
-
raise RuntimeError("No context found")
|
|
182
|
-
return AllModelsForRenderResponse(
|
|
183
|
-
models=self.lsp_context.list_of_models_for_rendering()
|
|
184
|
-
)
|
|
185
|
-
|
|
186
|
-
@self.server.feature(SUPPORTED_METHODS_FEATURE)
|
|
187
|
-
def supported_methods(
|
|
188
|
-
ls: LanguageServer, params: SupportedMethodsRequest
|
|
189
|
-
) -> SupportedMethodsResponse:
|
|
190
|
-
"""Return all supported custom LSP methods."""
|
|
191
|
-
return SupportedMethodsResponse(
|
|
192
|
-
methods=[
|
|
193
|
-
CustomMethod(
|
|
194
|
-
name=name,
|
|
195
|
-
)
|
|
196
|
-
for name in SUPPORTED_CUSTOM_METHODS
|
|
197
|
-
]
|
|
198
|
-
)
|
|
199
|
-
|
|
200
|
-
@self.server.feature(FORMAT_PROJECT_FEATURE)
|
|
201
|
-
def format_project(
|
|
202
|
-
ls: LanguageServer, params: FormatProjectRequest
|
|
203
|
-
) -> FormatProjectResponse:
|
|
204
|
-
"""Format all models in the current project."""
|
|
205
|
-
try:
|
|
206
|
-
if self.lsp_context is None:
|
|
207
|
-
current_path = Path.cwd()
|
|
208
|
-
self._ensure_context_in_folder(current_path)
|
|
209
|
-
if self.lsp_context is None:
|
|
210
|
-
raise RuntimeError("No context found")
|
|
211
|
-
|
|
212
|
-
# Call the format method on the context
|
|
213
|
-
self.lsp_context.context.format()
|
|
214
|
-
return FormatProjectResponse()
|
|
215
|
-
except Exception as e:
|
|
216
|
-
ls.log_trace(f"Error formatting project: {e}")
|
|
217
|
-
return FormatProjectResponse()
|
|
218
|
-
|
|
219
|
-
@self.server.feature(API_FEATURE)
|
|
220
|
-
def api(ls: LanguageServer, request: ApiRequest) -> t.Dict[str, t.Any]:
|
|
221
|
-
ls.log_trace(f"API request: {request}")
|
|
222
|
-
if self.lsp_context is None:
|
|
223
|
-
current_path = Path.cwd()
|
|
224
|
-
self._ensure_context_in_folder(current_path)
|
|
225
|
-
if self.lsp_context is None:
|
|
226
|
-
raise RuntimeError("No context found")
|
|
227
|
-
|
|
228
|
-
parsed_url = urllib.parse.urlparse(request.url)
|
|
229
|
-
path_parts = parsed_url.path.strip("/").split("/")
|
|
230
|
-
|
|
231
|
-
if request.method == "GET":
|
|
232
|
-
if path_parts == ["api", "models"]:
|
|
233
|
-
# /api/models
|
|
234
|
-
return ApiResponseGetModels(
|
|
235
|
-
data=get_models(self.lsp_context.context)
|
|
236
|
-
).model_dump(mode="json")
|
|
237
|
-
|
|
238
|
-
if path_parts[:2] == ["api", "lineage"]:
|
|
239
|
-
if len(path_parts) == 3:
|
|
240
|
-
# /api/lineage/{model}
|
|
241
|
-
model_name = urllib.parse.unquote(path_parts[2])
|
|
242
|
-
lineage = model_lineage(model_name, self.lsp_context.context)
|
|
243
|
-
non_set_lineage = {k: v for k, v in lineage.items() if v is not None}
|
|
244
|
-
return ApiResponseGetLineage(data=non_set_lineage).model_dump(mode="json")
|
|
245
|
-
|
|
246
|
-
if len(path_parts) == 4:
|
|
247
|
-
# /api/lineage/{model}/{column}
|
|
248
|
-
model_name = urllib.parse.unquote(path_parts[2])
|
|
249
|
-
column = urllib.parse.unquote(path_parts[3])
|
|
250
|
-
models_only = False
|
|
251
|
-
if hasattr(request, "params"):
|
|
252
|
-
models_only = bool(getattr(request.params, "models_only", False))
|
|
253
|
-
column_lineage_response = column_lineage(
|
|
254
|
-
model_name, column, models_only, self.lsp_context.context
|
|
255
|
-
)
|
|
256
|
-
return ApiResponseGetColumnLineage(data=column_lineage_response).model_dump(
|
|
257
|
-
mode="json"
|
|
258
|
-
)
|
|
259
|
-
|
|
260
|
-
raise NotImplementedError(f"API request not implemented: {request.url}")
|
|
261
|
-
|
|
262
275
|
@self.server.feature(types.TEXT_DOCUMENT_DID_OPEN)
|
|
263
276
|
def did_open(ls: LanguageServer, params: types.DidOpenTextDocumentParams) -> None:
|
|
264
277
|
uri = URI(params.text_document.uri)
|
|
@@ -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=GVBH74f99kO6TD3p2z8tXsWrHAzRxwhFUVreCsTnSVA,530
|
|
3
3
|
sqlmesh/magics.py,sha256=gjzoxREb1XT8Yho_PQMlMqhhkLq_sEfBM8S3PTgxvWE,40337
|
|
4
4
|
sqlmesh/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
sqlmesh/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -158,14 +158,14 @@ sqlmesh/integrations/github/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
|
|
|
158
158
|
sqlmesh/integrations/github/cicd/command.py,sha256=rNWb-aMOA9R23YumD5vPwR0PgPGGj8KwG6KG1ftdqV0,11586
|
|
159
159
|
sqlmesh/integrations/github/cicd/config.py,sha256=tRhMZaLf1p6AWXvi67n85Q-lptJNGt1Wk_Jr61ytpiM,2104
|
|
160
160
|
sqlmesh/integrations/github/cicd/controller.py,sha256=IgUWK9orYSMiElO3GaL6Ja-osFgA7je3RDcLChWUi5s,43769
|
|
161
|
-
sqlmesh/lsp/api.py,sha256=
|
|
161
|
+
sqlmesh/lsp/api.py,sha256=_lA_buSPZFIoLJuINbS53LbNOOaHp3orb0uFTE3aCqI,2328
|
|
162
162
|
sqlmesh/lsp/completions.py,sha256=dsGE8f6RWNjOPvs80QdTvv1YaKo1bbTJ5ZzQmnNcpbA,6184
|
|
163
163
|
sqlmesh/lsp/context.py,sha256=QGbNL0sifxzVJ7T1U5oWcJ5FXrOrLrVKt1jtH1qM_50,6099
|
|
164
|
-
sqlmesh/lsp/custom.py,sha256=
|
|
164
|
+
sqlmesh/lsp/custom.py,sha256=ka-q1uPy7Vf5OWK5qkRxpnSZjz7vjYKigGCfPBmEPC0,2542
|
|
165
165
|
sqlmesh/lsp/description.py,sha256=4QIGC9ix8IzmWF6DVUNhY4m1Crk3sNQA6hZ1RbyqU78,827
|
|
166
166
|
sqlmesh/lsp/helpers.py,sha256=igzUgeYAO3LUZFr3qN4l9hzztOy66lRubX93KtCMduY,654
|
|
167
167
|
sqlmesh/lsp/hints.py,sha256=j-blccBUil94yRoDjWfkSM0HqMmsKD6hP2TaWdWWVk4,3734
|
|
168
|
-
sqlmesh/lsp/main.py,sha256
|
|
168
|
+
sqlmesh/lsp/main.py,sha256=46ftQ1e3foRs93xSsycDeapDpEBKjxjERWJbT1p0He8,35596
|
|
169
169
|
sqlmesh/lsp/reference.py,sha256=2rAYfwrKRfxlYA3psTDLacxYWvuFaouMyS7plOSYHiQ,23883
|
|
170
170
|
sqlmesh/lsp/uri.py,sha256=mvSLbZGmMTHPpliThOtVWiFcHnfJzp1w39q9l-xD2SI,802
|
|
171
171
|
sqlmesh/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -275,7 +275,7 @@ sqlmesh/utils/pydantic.py,sha256=I898jAFqa3qU6lG2uPpRebVFncOUo8ZrLWM_R3K3DHU,116
|
|
|
275
275
|
sqlmesh/utils/rich.py,sha256=xNZyPCqEc4TAlJlsEthg-5eYUWpaizz0QjBzO7a1Yv4,1509
|
|
276
276
|
sqlmesh/utils/windows.py,sha256=r7Yin4WEwbvH7sKA3hOJtRsclmscNuBeCklCfVPvtQs,611
|
|
277
277
|
sqlmesh/utils/yaml.py,sha256=np-WVcwmwsKghCgAj1OBBMsK1SXSRn4wR-H37cGiFr8,2282
|
|
278
|
-
sqlmesh-0.189.3.
|
|
278
|
+
sqlmesh-0.189.3.dev28.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
|
|
279
279
|
web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
280
280
|
web/client/dist/index.html,sha256=k5bAEoPDJ0BhYQ4hBcKWObITCxIgqOUC28nGXvEDrt0,5472
|
|
281
281
|
web/client/dist/assets/Audits-Pgs8N6IE.js,sha256=BQuc9kiznZSqTnzNrJSDNqAAdOTGjNQJt32M1sHZFok,1041
|
|
@@ -393,8 +393,8 @@ web/server/api/endpoints/models.py,sha256=ud-lRwriyI_OYg9tZchrBgeiXELiRTLNEodraf
|
|
|
393
393
|
web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
|
|
394
394
|
web/server/api/endpoints/plan.py,sha256=OYuQ_4dgbhG9ibTcX1a8mvYgH3ANxw9Fhbb4wg6QWqc,9222
|
|
395
395
|
web/server/api/endpoints/table_diff.py,sha256=SCy3-pr5x6bEEiOaZGCDbiHQhpgxwmnz3Acqa2Ie6jI,2090
|
|
396
|
-
sqlmesh-0.189.3.
|
|
397
|
-
sqlmesh-0.189.3.
|
|
398
|
-
sqlmesh-0.189.3.
|
|
399
|
-
sqlmesh-0.189.3.
|
|
400
|
-
sqlmesh-0.189.3.
|
|
396
|
+
sqlmesh-0.189.3.dev28.dist-info/METADATA,sha256=NrbwoHyj4DNuplBRd_BznTobxHC6nOmRhNK6FtnfWo4,26541
|
|
397
|
+
sqlmesh-0.189.3.dev28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
398
|
+
sqlmesh-0.189.3.dev28.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
|
|
399
|
+
sqlmesh-0.189.3.dev28.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
|
|
400
|
+
sqlmesh-0.189.3.dev28.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|