sqlmesh 0.186.2.dev3__py3-none-any.whl → 0.186.2.dev5__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/description.py +30 -0
- sqlmesh/lsp/main.py +3 -2
- sqlmesh/lsp/reference.py +6 -3
- {sqlmesh-0.186.2.dev3.dist-info → sqlmesh-0.186.2.dev5.dist-info}/METADATA +1 -1
- {sqlmesh-0.186.2.dev3.dist-info → sqlmesh-0.186.2.dev5.dist-info}/RECORD +10 -9
- {sqlmesh-0.186.2.dev3.dist-info → sqlmesh-0.186.2.dev5.dist-info}/WHEEL +0 -0
- {sqlmesh-0.186.2.dev3.dist-info → sqlmesh-0.186.2.dev5.dist-info}/entry_points.txt +0 -0
- {sqlmesh-0.186.2.dev3.dist-info → sqlmesh-0.186.2.dev5.dist-info}/licenses/LICENSE +0 -0
- {sqlmesh-0.186.2.dev3.dist-info → sqlmesh-0.186.2.dev5.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.dev5'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 186, 2, 'dev5')
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from sqlmesh.core.model.definition import (
|
|
2
|
+
ExternalModel,
|
|
3
|
+
PythonModel,
|
|
4
|
+
SeedModel,
|
|
5
|
+
SqlModel,
|
|
6
|
+
)
|
|
7
|
+
import typing as t
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def generate_markdown_description(
|
|
11
|
+
model: t.Union[SqlModel, ExternalModel, PythonModel, SeedModel],
|
|
12
|
+
) -> t.Optional[str]:
|
|
13
|
+
columns = model.columns_to_types
|
|
14
|
+
column_descriptions = model.column_descriptions
|
|
15
|
+
|
|
16
|
+
columns_table = (
|
|
17
|
+
"\n".join(
|
|
18
|
+
[
|
|
19
|
+
f"| {column} | {column_type} | {column_descriptions.get(column, '')} |"
|
|
20
|
+
for column, column_type in columns.items()
|
|
21
|
+
]
|
|
22
|
+
)
|
|
23
|
+
if columns
|
|
24
|
+
else ""
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
table_header = "\n\n| Column | Type | Description |\n|--------|------|-------------|\n"
|
|
28
|
+
return (
|
|
29
|
+
f"{model.description}{table_header}{columns_table}" if columns_table else model.description
|
|
30
|
+
)
|
sqlmesh/lsp/main.py
CHANGED
|
@@ -239,11 +239,12 @@ class SQLMeshLanguageServer:
|
|
|
239
239
|
if not references:
|
|
240
240
|
return None
|
|
241
241
|
reference = references[0]
|
|
242
|
-
if not reference.
|
|
242
|
+
if not reference.markdown_description:
|
|
243
243
|
return None
|
|
244
244
|
return types.Hover(
|
|
245
245
|
contents=types.MarkupContent(
|
|
246
|
-
kind=types.MarkupKind.Markdown,
|
|
246
|
+
kind=types.MarkupKind.Markdown,
|
|
247
|
+
value=reference.markdown_description,
|
|
247
248
|
),
|
|
248
249
|
range=reference.range,
|
|
249
250
|
)
|
sqlmesh/lsp/reference.py
CHANGED
|
@@ -5,6 +5,7 @@ from sqlmesh.core.dialect import normalize_model_name
|
|
|
5
5
|
from sqlmesh.core.model.definition import SqlModel
|
|
6
6
|
from sqlmesh.lsp.context import LSPContext, ModelTarget, AuditTarget
|
|
7
7
|
from sqlglot import exp
|
|
8
|
+
from sqlmesh.lsp.description import generate_markdown_description
|
|
8
9
|
from sqlmesh.lsp.uri import URI
|
|
9
10
|
from sqlmesh.utils.pydantic import PydanticModel
|
|
10
11
|
|
|
@@ -16,12 +17,12 @@ class Reference(PydanticModel):
|
|
|
16
17
|
Attributes:
|
|
17
18
|
range: The range of the reference in the source file
|
|
18
19
|
uri: The uri of the referenced model
|
|
19
|
-
|
|
20
|
+
markdown_description: The markdown description of the referenced model
|
|
20
21
|
"""
|
|
21
22
|
|
|
22
23
|
range: Range
|
|
23
24
|
uri: str
|
|
24
|
-
|
|
25
|
+
markdown_description: t.Optional[str] = None
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
def by_position(position: Position) -> t.Callable[[Reference], bool]:
|
|
@@ -176,11 +177,13 @@ def get_model_definitions_for_a_path(
|
|
|
176
177
|
catalog_or_db_range = _range_from_token_position_details(catalog_or_db_meta, read_file)
|
|
177
178
|
start_pos = catalog_or_db_range.start
|
|
178
179
|
|
|
180
|
+
description = generate_markdown_description(referenced_model)
|
|
181
|
+
|
|
179
182
|
references.append(
|
|
180
183
|
Reference(
|
|
181
184
|
uri=referenced_model_uri.value,
|
|
182
185
|
range=Range(start=start_pos, end=end_pos),
|
|
183
|
-
|
|
186
|
+
markdown_description=description,
|
|
184
187
|
)
|
|
185
188
|
)
|
|
186
189
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
sqlmesh/__init__.py,sha256=69xw6bTmi4cW90M-sl3g6wLDgxVcLHcKg1q8GS3lqyA,7466
|
|
2
|
-
sqlmesh/_version.py,sha256=
|
|
2
|
+
sqlmesh/_version.py,sha256=IaslbwtM59zf1WF6ptdjpwA2fYR3PqAZ0HkxEx7OhLI,528
|
|
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
|
|
@@ -159,8 +159,9 @@ sqlmesh/lsp/api.py,sha256=LJdECSaEZoPbu_Xl4KscVG-WLt7_g4dY-zKGO68dH14,2162
|
|
|
159
159
|
sqlmesh/lsp/completions.py,sha256=Uo8lUzPBeoB58Eu2642YoAtNI0pgIFWFSvwmuJALTv4,3583
|
|
160
160
|
sqlmesh/lsp/context.py,sha256=Ff09vrsawdYS-7YcXbGZW_RU-tj_-k8WV7maCghpYp0,1438
|
|
161
161
|
sqlmesh/lsp/custom.py,sha256=GvNAiW7imPI8xmIx3qLWN5FljGPHFJKh0N5b6aZnwRo,489
|
|
162
|
-
sqlmesh/lsp/
|
|
163
|
-
sqlmesh/lsp/
|
|
162
|
+
sqlmesh/lsp/description.py,sha256=4QIGC9ix8IzmWF6DVUNhY4m1Crk3sNQA6hZ1RbyqU78,827
|
|
163
|
+
sqlmesh/lsp/main.py,sha256=x2rPSDdYtB3S6baXMYUl0XOvvAtyGJhQgVLp_Ql7uPk,18087
|
|
164
|
+
sqlmesh/lsp/reference.py,sha256=bO2edkI2avmEYayQI11_OsDX1gjp36kq9ANwHczWSC0,8285
|
|
164
165
|
sqlmesh/lsp/uri.py,sha256=mvSLbZGmMTHPpliThOtVWiFcHnfJzp1w39q9l-xD2SI,802
|
|
165
166
|
sqlmesh/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
166
167
|
sqlmesh/migrations/v0001_init.py,sha256=h8FwMYJj9_O8yGpk12guaSaGwX5A3we2GiKeHrXi15o,2048
|
|
@@ -268,7 +269,7 @@ sqlmesh/utils/pydantic.py,sha256=I898jAFqa3qU6lG2uPpRebVFncOUo8ZrLWM_R3K3DHU,116
|
|
|
268
269
|
sqlmesh/utils/rich.py,sha256=xNZyPCqEc4TAlJlsEthg-5eYUWpaizz0QjBzO7a1Yv4,1509
|
|
269
270
|
sqlmesh/utils/windows.py,sha256=r7Yin4WEwbvH7sKA3hOJtRsclmscNuBeCklCfVPvtQs,611
|
|
270
271
|
sqlmesh/utils/yaml.py,sha256=np-WVcwmwsKghCgAj1OBBMsK1SXSRn4wR-H37cGiFr8,2282
|
|
271
|
-
sqlmesh-0.186.2.
|
|
272
|
+
sqlmesh-0.186.2.dev5.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
|
|
272
273
|
web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
273
274
|
web/client/dist/index.html,sha256=M50OuwjW63dRCS0Dz40Yecgvw9ecLFqizbTa6gv5Nd4,5472
|
|
274
275
|
web/client/dist/assets/Audits-BPlxzqeG.js,sha256=TCx1qCjCGgmUSvH6HoPr5t8ztbRXMlOxrcW4o7hRjlA,1041
|
|
@@ -386,8 +387,8 @@ web/server/api/endpoints/models.py,sha256=ud-lRwriyI_OYg9tZchrBgeiXELiRTLNEodraf
|
|
|
386
387
|
web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
|
|
387
388
|
web/server/api/endpoints/plan.py,sha256=OYuQ_4dgbhG9ibTcX1a8mvYgH3ANxw9Fhbb4wg6QWqc,9222
|
|
388
389
|
web/server/api/endpoints/table_diff.py,sha256=Wd5YxeKbZB7AkrDvqFgvV9ZQlnKYOF1n5W_w2EHE_Zw,2085
|
|
389
|
-
sqlmesh-0.186.2.
|
|
390
|
-
sqlmesh-0.186.2.
|
|
391
|
-
sqlmesh-0.186.2.
|
|
392
|
-
sqlmesh-0.186.2.
|
|
393
|
-
sqlmesh-0.186.2.
|
|
390
|
+
sqlmesh-0.186.2.dev5.dist-info/METADATA,sha256=lM2kCYAQyoqNtFf3loq7lJxEwDXNYfwQH4J0HktxxL8,25523
|
|
391
|
+
sqlmesh-0.186.2.dev5.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
392
|
+
sqlmesh-0.186.2.dev5.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
|
|
393
|
+
sqlmesh-0.186.2.dev5.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
|
|
394
|
+
sqlmesh-0.186.2.dev5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|