sqlmesh 0.190.1.dev4__py3-none-any.whl → 0.190.1.dev6__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/completions.py +28 -19
- sqlmesh/lsp/custom.py +10 -3
- sqlmesh/lsp/main.py +8 -2
- {sqlmesh-0.190.1.dev4.dist-info → sqlmesh-0.190.1.dev6.dist-info}/METADATA +1 -1
- {sqlmesh-0.190.1.dev4.dist-info → sqlmesh-0.190.1.dev6.dist-info}/RECORD +10 -10
- {sqlmesh-0.190.1.dev4.dist-info → sqlmesh-0.190.1.dev6.dist-info}/WHEEL +0 -0
- {sqlmesh-0.190.1.dev4.dist-info → sqlmesh-0.190.1.dev6.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.190.1.dev4.dist-info → sqlmesh-0.190.1.dev6.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.190.1.dev4.dist-info → sqlmesh-0.190.1.dev6.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.190.1.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 190, 1, '
|
|
20
|
+
__version__ = version = '0.190.1.dev6'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 190, 1, 'dev6')
|
sqlmesh/lsp/completions.py
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
from functools import lru_cache
|
|
2
2
|
from sqlglot import Dialect, Tokenizer
|
|
3
|
-
from sqlmesh.lsp.custom import
|
|
3
|
+
from sqlmesh.lsp.custom import (
|
|
4
|
+
AllModelsResponse,
|
|
5
|
+
MacroCompletion,
|
|
6
|
+
ModelCompletion,
|
|
7
|
+
)
|
|
4
8
|
from sqlmesh import macro
|
|
5
9
|
import typing as t
|
|
6
10
|
from sqlmesh.lsp.context import AuditTarget, LSPContext, ModelTarget
|
|
11
|
+
from sqlmesh.lsp.description import generate_markdown_description
|
|
7
12
|
from sqlmesh.lsp.uri import URI
|
|
8
13
|
|
|
9
14
|
|
|
@@ -26,14 +31,18 @@ def get_sql_completions(
|
|
|
26
31
|
# Combine keywords - SQL keywords first, then file keywords
|
|
27
32
|
all_keywords = list(sql_keywords) + list(file_keywords - sql_keywords)
|
|
28
33
|
|
|
34
|
+
models = list(get_models(context, file_uri))
|
|
29
35
|
return AllModelsResponse(
|
|
30
|
-
models=
|
|
36
|
+
models=[m.name for m in models],
|
|
37
|
+
model_completions=models,
|
|
31
38
|
keywords=all_keywords,
|
|
32
39
|
macros=list(get_macros(context, file_uri)),
|
|
33
40
|
)
|
|
34
41
|
|
|
35
42
|
|
|
36
|
-
def get_models(
|
|
43
|
+
def get_models(
|
|
44
|
+
context: t.Optional[LSPContext], file_uri: t.Optional[URI]
|
|
45
|
+
) -> t.List[ModelCompletion]:
|
|
37
46
|
"""
|
|
38
47
|
Return a list of models for a given file.
|
|
39
48
|
|
|
@@ -41,23 +50,23 @@ def get_models(context: t.Optional[LSPContext], file_uri: t.Optional[URI]) -> t.
|
|
|
41
50
|
If there is a context, return a list of all models bar the ones the file itself defines.
|
|
42
51
|
"""
|
|
43
52
|
if context is None:
|
|
44
|
-
return
|
|
53
|
+
return []
|
|
54
|
+
|
|
55
|
+
current_path = file_uri.to_path() if file_uri is not None else None
|
|
56
|
+
|
|
57
|
+
completions: t.List[ModelCompletion] = []
|
|
58
|
+
for model in context.context.models.values():
|
|
59
|
+
if current_path is not None and model._path == current_path:
|
|
60
|
+
continue
|
|
61
|
+
description = None
|
|
62
|
+
try:
|
|
63
|
+
description = generate_markdown_description(model)
|
|
64
|
+
except Exception:
|
|
65
|
+
description = getattr(model, "description", None)
|
|
66
|
+
|
|
67
|
+
completions.append(ModelCompletion(name=model.name, description=description))
|
|
45
68
|
|
|
46
|
-
|
|
47
|
-
# Extract model names from ModelInfo objects
|
|
48
|
-
for file_info in context.map.values():
|
|
49
|
-
if isinstance(file_info, ModelTarget):
|
|
50
|
-
all_models.update(file_info.names)
|
|
51
|
-
|
|
52
|
-
# Remove models from the current file
|
|
53
|
-
path = file_uri.to_path() if file_uri is not None else None
|
|
54
|
-
if path is not None and path in context.map:
|
|
55
|
-
file_info = context.map[path]
|
|
56
|
-
if isinstance(file_info, ModelTarget):
|
|
57
|
-
for model in file_info.names:
|
|
58
|
-
all_models.discard(model)
|
|
59
|
-
|
|
60
|
-
return all_models
|
|
69
|
+
return completions
|
|
61
70
|
|
|
62
71
|
|
|
63
72
|
def get_macros(
|
sqlmesh/lsp/custom.py
CHANGED
|
@@ -30,12 +30,19 @@ class MacroCompletion(PydanticModel):
|
|
|
30
30
|
description: t.Optional[str] = None
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
class ModelCompletion(PydanticModel):
|
|
34
|
+
"""Information about a model for autocompletion."""
|
|
35
|
+
|
|
36
|
+
name: str
|
|
37
|
+
description: t.Optional[str] = None
|
|
38
|
+
|
|
39
|
+
|
|
33
40
|
class AllModelsResponse(CustomMethodResponseBaseClass):
|
|
34
|
-
"""
|
|
35
|
-
Response to get all the models that are in the current project.
|
|
36
|
-
"""
|
|
41
|
+
"""Response to get all models that are in the current project."""
|
|
37
42
|
|
|
43
|
+
#: Deprecated: use ``model_completions`` instead
|
|
38
44
|
models: t.List[str]
|
|
45
|
+
model_completions: t.List[ModelCompletion]
|
|
39
46
|
keywords: t.List[str]
|
|
40
47
|
macros: t.List[MacroCompletion]
|
|
41
48
|
|
sqlmesh/lsp/main.py
CHANGED
|
@@ -627,12 +627,18 @@ class SQLMeshLanguageServer:
|
|
|
627
627
|
|
|
628
628
|
completion_items = []
|
|
629
629
|
# Add model completions
|
|
630
|
-
for model in completion_response.
|
|
630
|
+
for model in completion_response.model_completions:
|
|
631
631
|
completion_items.append(
|
|
632
632
|
types.CompletionItem(
|
|
633
|
-
label=model,
|
|
633
|
+
label=model.name,
|
|
634
634
|
kind=types.CompletionItemKind.Reference,
|
|
635
635
|
detail="SQLMesh Model",
|
|
636
|
+
documentation=types.MarkupContent(
|
|
637
|
+
kind=types.MarkupKind.Markdown,
|
|
638
|
+
value=model.description or "No description available",
|
|
639
|
+
)
|
|
640
|
+
if model.description
|
|
641
|
+
else None,
|
|
636
642
|
)
|
|
637
643
|
)
|
|
638
644
|
# Add macro completions
|
|
@@ -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=-U_QhWMFCSI0QtG8CpandTmK6UBqPUt_MQe1hlymRF0,528
|
|
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
|
|
@@ -159,13 +159,13 @@ sqlmesh/integrations/github/cicd/command.py,sha256=rNWb-aMOA9R23YumD5vPwR0PgPGGj
|
|
|
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
161
|
sqlmesh/lsp/api.py,sha256=_lA_buSPZFIoLJuINbS53LbNOOaHp3orb0uFTE3aCqI,2328
|
|
162
|
-
sqlmesh/lsp/completions.py,sha256=
|
|
162
|
+
sqlmesh/lsp/completions.py,sha256=Nt1XpFL_-QAIRM8BBBC6Ia6YG0hMZriiNJra7nGfD4Q,6676
|
|
163
163
|
sqlmesh/lsp/context.py,sha256=QGbNL0sifxzVJ7T1U5oWcJ5FXrOrLrVKt1jtH1qM_50,6099
|
|
164
|
-
sqlmesh/lsp/custom.py,sha256=
|
|
164
|
+
sqlmesh/lsp/custom.py,sha256=IJ70li8d5RbOFDrjHfsI2UNOiOp-WB22lrgpdJ7lVSg,2942
|
|
165
165
|
sqlmesh/lsp/description.py,sha256=4QIGC9ix8IzmWF6DVUNhY4m1Crk3sNQA6hZ1RbyqU78,827
|
|
166
166
|
sqlmesh/lsp/helpers.py,sha256=EFc1u3-b7kSv5-tNwmKUDxId72RCLDBnN2lLTgRSzzQ,1020
|
|
167
167
|
sqlmesh/lsp/hints.py,sha256=j-blccBUil94yRoDjWfkSM0HqMmsKD6hP2TaWdWWVk4,3734
|
|
168
|
-
sqlmesh/lsp/main.py,sha256=
|
|
168
|
+
sqlmesh/lsp/main.py,sha256=w06r1KpMwxILMTTWYOSc7Cc9dXq97TVPrembj_T32DY,37012
|
|
169
169
|
sqlmesh/lsp/reference.py,sha256=8hZT3wH8zmWiFEySS1_nVhhLg-CKCGncf9wG3LGBef8,26432
|
|
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.190.1.
|
|
278
|
+
sqlmesh-0.190.1.dev6.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.190.1.
|
|
397
|
-
sqlmesh-0.190.1.
|
|
398
|
-
sqlmesh-0.190.1.
|
|
399
|
-
sqlmesh-0.190.1.
|
|
400
|
-
sqlmesh-0.190.1.
|
|
396
|
+
sqlmesh-0.190.1.dev6.dist-info/METADATA,sha256=gcHiiN-JLRAwIsm_tpRUMYDWtUEpDviJ5PZwuAk3QFc,26540
|
|
397
|
+
sqlmesh-0.190.1.dev6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
398
|
+
sqlmesh-0.190.1.dev6.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
|
|
399
|
+
sqlmesh-0.190.1.dev6.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
|
|
400
|
+
sqlmesh-0.190.1.dev6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|