-
Notifications
You must be signed in to change notification settings - Fork 380
Expand file tree
/
Copy pathcustom.py
More file actions
172 lines (101 loc) · 3.36 KB
/
custom.py
File metadata and controls
172 lines (101 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
from lsprotocol import types
import typing as t
from sqlmesh.utils.pydantic import PydanticModel
class CustomMethodRequestBaseClass(PydanticModel):
pass
class CustomMethodResponseBaseClass(PydanticModel):
# Prefixing, so guaranteed not to collide
response_error: t.Optional[str] = None
ALL_MODELS_FEATURE = "sqlmesh/all_models"
class AllModelsRequest(CustomMethodRequestBaseClass):
"""
Request to get all the models that are in the current project.
"""
textDocument: types.TextDocumentIdentifier
class MacroCompletion(PydanticModel):
"""Information about a macro for autocompletion."""
name: str
description: t.Optional[str] = None
class ModelCompletion(PydanticModel):
"""Information about a model for autocompletion."""
name: str
description: t.Optional[str] = None
class AllModelsResponse(CustomMethodResponseBaseClass):
"""Response to get all models that are in the current project."""
#: Deprecated: use ``model_completions`` instead
models: t.List[str]
model_completions: t.List[ModelCompletion]
keywords: t.List[str]
macros: t.List[MacroCompletion]
RENDER_MODEL_FEATURE = "sqlmesh/render_model"
class RenderModelRequest(CustomMethodRequestBaseClass):
textDocumentUri: str
class RenderModelEntry(PydanticModel):
"""
An entry in the rendered model.
"""
name: str
fqn: str
description: t.Optional[str] = None
rendered_query: str
class RenderModelResponse(CustomMethodResponseBaseClass):
"""
Response to render a model.
"""
models: t.List[RenderModelEntry]
ALL_MODELS_FOR_RENDER_FEATURE = "sqlmesh/all_models_for_render"
class ModelForRendering(PydanticModel):
"""
A model that is available for rendering.
"""
name: str
fqn: str
description: t.Optional[str] = None
uri: str
class AllModelsForRenderRequest(CustomMethodRequestBaseClass):
pass
class AllModelsForRenderResponse(CustomMethodResponseBaseClass):
"""
Response to get all the models that are in the current project for rendering purposes.
"""
models: t.List[ModelForRendering]
SUPPORTED_METHODS_FEATURE = "sqlmesh/supported_methods"
class SupportedMethodsRequest(PydanticModel):
"""
Request to get all supported custom LSP methods.
"""
pass
class CustomMethod(PydanticModel):
"""
Information about a custom LSP method.
"""
name: str
class SupportedMethodsResponse(CustomMethodResponseBaseClass):
"""
Response containing all supported custom LSP methods.
"""
methods: t.List[CustomMethod]
FORMAT_PROJECT_FEATURE = "sqlmesh/format_project"
class FormatProjectRequest(CustomMethodRequestBaseClass):
"""
Request to format all models in the current project.
"""
pass
class FormatProjectResponse(CustomMethodResponseBaseClass):
"""
Response to format project request.
"""
pass
LIST_ENVIRONMENTS_FEATURE = "sqlmesh/list_environments"
class ListEnvironmentsRequest(CustomMethodRequestBaseClass):
pass
class ListEnvironmentsResponse(CustomMethodResponseBaseClass):
environments: t.List[str]
PLAN_DIFF_FEATURE = "sqlmesh/plan_diff"
class PlanDiffRequest(CustomMethodRequestBaseClass):
environment: str
class PlanDiffEntry(PydanticModel):
name: str
diff: str
class PlanDiffResponse(CustomMethodResponseBaseClass):
diffs: t.List[PlanDiffEntry]