sqlmesh 0.186.2.dev9__py3-none-any.whl → 0.186.2.dev11__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/context.py +38 -0
- sqlmesh/lsp/custom.py +26 -0
- sqlmesh/lsp/main.py +15 -2
- {sqlmesh-0.186.2.dev9.dist-info → sqlmesh-0.186.2.dev11.dist-info}/METADATA +1 -1
- {sqlmesh-0.186.2.dev9.dist-info → sqlmesh-0.186.2.dev11.dist-info}/RECORD +10 -10
- {sqlmesh-0.186.2.dev9.dist-info → sqlmesh-0.186.2.dev11.dist-info}/WHEEL +0 -0
- {sqlmesh-0.186.2.dev9.dist-info → sqlmesh-0.186.2.dev11.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.186.2.dev9.dist-info → sqlmesh-0.186.2.dev11.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.186.2.dev9.dist-info → sqlmesh-0.186.2.dev11.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.186.2.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 186, 2, '
|
|
20
|
+
__version__ = version = '0.186.2.dev11'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 186, 2, 'dev11')
|
sqlmesh/lsp/context.py
CHANGED
|
@@ -3,6 +3,10 @@ from pathlib import Path
|
|
|
3
3
|
from sqlmesh.core.context import Context
|
|
4
4
|
import typing as t
|
|
5
5
|
|
|
6
|
+
from sqlmesh.core.model.definition import SqlModel
|
|
7
|
+
from sqlmesh.lsp.custom import RenderModelEntry
|
|
8
|
+
from sqlmesh.lsp.uri import URI
|
|
9
|
+
|
|
6
10
|
|
|
7
11
|
@dataclass
|
|
8
12
|
class ModelTarget:
|
|
@@ -49,3 +53,37 @@ class LSPContext:
|
|
|
49
53
|
**model_map,
|
|
50
54
|
**audit_map,
|
|
51
55
|
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def render_model(context: LSPContext, uri: URI) -> t.Iterator[RenderModelEntry]:
|
|
59
|
+
target = context.map[uri.to_path()]
|
|
60
|
+
if isinstance(target, AuditTarget):
|
|
61
|
+
audit = context.context.standalone_audits[target.name]
|
|
62
|
+
definition = audit.render_definition(
|
|
63
|
+
include_python=False,
|
|
64
|
+
render_query=True,
|
|
65
|
+
)
|
|
66
|
+
rendered_query = [render.sql(dialect=audit.dialect, pretty=True) for render in definition]
|
|
67
|
+
yield RenderModelEntry(
|
|
68
|
+
name=audit.name,
|
|
69
|
+
fqn=audit.fqn,
|
|
70
|
+
description=audit.description,
|
|
71
|
+
rendered_query="\n\n".join(rendered_query),
|
|
72
|
+
)
|
|
73
|
+
if isinstance(target, ModelTarget):
|
|
74
|
+
for name in target.names:
|
|
75
|
+
model = context.context.get_model(name)
|
|
76
|
+
if isinstance(model, SqlModel):
|
|
77
|
+
rendered_query = [
|
|
78
|
+
render.sql(dialect=model.dialect, pretty=True)
|
|
79
|
+
for render in model.render_definition(
|
|
80
|
+
include_python=False,
|
|
81
|
+
render_query=True,
|
|
82
|
+
)
|
|
83
|
+
]
|
|
84
|
+
yield RenderModelEntry(
|
|
85
|
+
name=model.name,
|
|
86
|
+
fqn=model.fqn,
|
|
87
|
+
description=model.description,
|
|
88
|
+
rendered_query="\n\n".join(rendered_query),
|
|
89
|
+
)
|
sqlmesh/lsp/custom.py
CHANGED
|
@@ -20,3 +20,29 @@ class AllModelsResponse(PydanticModel):
|
|
|
20
20
|
|
|
21
21
|
models: t.List[str]
|
|
22
22
|
keywords: t.List[str]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
RENDER_MODEL_FEATURE = "sqlmesh/render_model"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class RenderModelRequest(PydanticModel):
|
|
29
|
+
textDocumentUri: str
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class RenderModelEntry(PydanticModel):
|
|
33
|
+
"""
|
|
34
|
+
An entry in the rendered model.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
name: str
|
|
38
|
+
fqn: str
|
|
39
|
+
description: str
|
|
40
|
+
rendered_query: str
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class RenderModelResponse(PydanticModel):
|
|
44
|
+
"""
|
|
45
|
+
Response to render a model.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
models: t.List[RenderModelEntry]
|
sqlmesh/lsp/main.py
CHANGED
|
@@ -20,8 +20,15 @@ from sqlmesh.lsp.api import (
|
|
|
20
20
|
ApiResponseGetModels,
|
|
21
21
|
)
|
|
22
22
|
from sqlmesh.lsp.completions import get_sql_completions
|
|
23
|
-
from sqlmesh.lsp.context import LSPContext, ModelTarget
|
|
24
|
-
from sqlmesh.lsp.custom import
|
|
23
|
+
from sqlmesh.lsp.context import LSPContext, ModelTarget, render_model as render_model_context
|
|
24
|
+
from sqlmesh.lsp.custom import (
|
|
25
|
+
ALL_MODELS_FEATURE,
|
|
26
|
+
RENDER_MODEL_FEATURE,
|
|
27
|
+
AllModelsRequest,
|
|
28
|
+
AllModelsResponse,
|
|
29
|
+
RenderModelRequest,
|
|
30
|
+
RenderModelResponse,
|
|
31
|
+
)
|
|
25
32
|
from sqlmesh.lsp.reference import (
|
|
26
33
|
get_references,
|
|
27
34
|
)
|
|
@@ -88,6 +95,12 @@ class SQLMeshLanguageServer:
|
|
|
88
95
|
except Exception as e:
|
|
89
96
|
return get_sql_completions(None, uri)
|
|
90
97
|
|
|
98
|
+
@self.server.feature(RENDER_MODEL_FEATURE)
|
|
99
|
+
def render_model(ls: LanguageServer, params: RenderModelRequest) -> RenderModelResponse:
|
|
100
|
+
uri = URI(params.textDocumentUri)
|
|
101
|
+
context = self._context_get_or_load(uri)
|
|
102
|
+
return RenderModelResponse(models=list(render_model_context(context, uri)))
|
|
103
|
+
|
|
91
104
|
@self.server.feature(API_FEATURE)
|
|
92
105
|
def api(ls: LanguageServer, request: ApiRequest) -> t.Dict[str, t.Any]:
|
|
93
106
|
ls.log_trace(f"API request: {request}")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
sqlmesh/__init__.py,sha256=69xw6bTmi4cW90M-sl3g6wLDgxVcLHcKg1q8GS3lqyA,7466
|
|
2
|
-
sqlmesh/_version.py,sha256=
|
|
2
|
+
sqlmesh/_version.py,sha256=xBlsO_cc3Rn15-v22URdHGhMCdLnw__XWcjdZeZXz4w,530
|
|
3
3
|
sqlmesh/magics.py,sha256=JHorAZNtezf123jmTyNSoUC9yHmv-08hMP205PJmmIo,39750
|
|
4
4
|
sqlmesh/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
sqlmesh/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -157,10 +157,10 @@ sqlmesh/integrations/github/cicd/config.py,sha256=tRhMZaLf1p6AWXvi67n85Q-lptJNGt
|
|
|
157
157
|
sqlmesh/integrations/github/cicd/controller.py,sha256=EXFB_AHR_B4gTXMjX3CE6jZSvlENJ2BiI-Y7Wg6eGq4,41667
|
|
158
158
|
sqlmesh/lsp/api.py,sha256=LJdECSaEZoPbu_Xl4KscVG-WLt7_g4dY-zKGO68dH14,2162
|
|
159
159
|
sqlmesh/lsp/completions.py,sha256=Uo8lUzPBeoB58Eu2642YoAtNI0pgIFWFSvwmuJALTv4,3583
|
|
160
|
-
sqlmesh/lsp/context.py,sha256=
|
|
161
|
-
sqlmesh/lsp/custom.py,sha256=
|
|
160
|
+
sqlmesh/lsp/context.py,sha256=nCWg2uVH28-IJC2uDYuCbiXTh1lUFElSpNu4Q-fDWi4,2918
|
|
161
|
+
sqlmesh/lsp/custom.py,sha256=1YVcQz0y-4cdsvTdOQvlhUQXwOqPBWi3v_u1X2EqQxE,901
|
|
162
162
|
sqlmesh/lsp/description.py,sha256=4QIGC9ix8IzmWF6DVUNhY4m1Crk3sNQA6hZ1RbyqU78,827
|
|
163
|
-
sqlmesh/lsp/main.py,sha256=
|
|
163
|
+
sqlmesh/lsp/main.py,sha256=5EF1xA1rESYq4sTKDJPPG9Zl6mx3xfy6dbzWBbDee0M,18553
|
|
164
164
|
sqlmesh/lsp/reference.py,sha256=bO2edkI2avmEYayQI11_OsDX1gjp36kq9ANwHczWSC0,8285
|
|
165
165
|
sqlmesh/lsp/uri.py,sha256=mvSLbZGmMTHPpliThOtVWiFcHnfJzp1w39q9l-xD2SI,802
|
|
166
166
|
sqlmesh/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -269,7 +269,7 @@ sqlmesh/utils/pydantic.py,sha256=I898jAFqa3qU6lG2uPpRebVFncOUo8ZrLWM_R3K3DHU,116
|
|
|
269
269
|
sqlmesh/utils/rich.py,sha256=xNZyPCqEc4TAlJlsEthg-5eYUWpaizz0QjBzO7a1Yv4,1509
|
|
270
270
|
sqlmesh/utils/windows.py,sha256=r7Yin4WEwbvH7sKA3hOJtRsclmscNuBeCklCfVPvtQs,611
|
|
271
271
|
sqlmesh/utils/yaml.py,sha256=np-WVcwmwsKghCgAj1OBBMsK1SXSRn4wR-H37cGiFr8,2282
|
|
272
|
-
sqlmesh-0.186.2.
|
|
272
|
+
sqlmesh-0.186.2.dev11.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
|
|
273
273
|
web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
274
274
|
web/client/dist/index.html,sha256=M50OuwjW63dRCS0Dz40Yecgvw9ecLFqizbTa6gv5Nd4,5472
|
|
275
275
|
web/client/dist/assets/Audits-BPlxzqeG.js,sha256=TCx1qCjCGgmUSvH6HoPr5t8ztbRXMlOxrcW4o7hRjlA,1041
|
|
@@ -387,8 +387,8 @@ web/server/api/endpoints/models.py,sha256=ud-lRwriyI_OYg9tZchrBgeiXELiRTLNEodraf
|
|
|
387
387
|
web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
|
|
388
388
|
web/server/api/endpoints/plan.py,sha256=OYuQ_4dgbhG9ibTcX1a8mvYgH3ANxw9Fhbb4wg6QWqc,9222
|
|
389
389
|
web/server/api/endpoints/table_diff.py,sha256=Wd5YxeKbZB7AkrDvqFgvV9ZQlnKYOF1n5W_w2EHE_Zw,2085
|
|
390
|
-
sqlmesh-0.186.2.
|
|
391
|
-
sqlmesh-0.186.2.
|
|
392
|
-
sqlmesh-0.186.2.
|
|
393
|
-
sqlmesh-0.186.2.
|
|
394
|
-
sqlmesh-0.186.2.
|
|
390
|
+
sqlmesh-0.186.2.dev11.dist-info/METADATA,sha256=IOFYQA2ApAqd-uK_CnG_aVdgziSCsIZibxpBmPWsL-o,25524
|
|
391
|
+
sqlmesh-0.186.2.dev11.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
392
|
+
sqlmesh-0.186.2.dev11.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
|
|
393
|
+
sqlmesh-0.186.2.dev11.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
|
|
394
|
+
sqlmesh-0.186.2.dev11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|