sqlmesh 0.184.2.dev1__py3-none-any.whl → 0.184.2.dev2__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 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.184.2.dev1'
21
- __version_tuple__ = version_tuple = (0, 184, 2, 'dev1')
20
+ __version__ = version = '0.184.2.dev2'
21
+ __version_tuple__ = version_tuple = (0, 184, 2, 'dev2')
sqlmesh/lsp/api.py CHANGED
@@ -10,7 +10,7 @@ separate process for the web api.
10
10
  import typing as t
11
11
  from pydantic import field_validator
12
12
  from sqlmesh.utils.pydantic import PydanticModel
13
- from web.server.models import Model
13
+ from web.server.models import LineageColumn, Model
14
14
 
15
15
  API_FEATURE = "sqlmesh/api"
16
16
 
@@ -59,3 +59,11 @@ class ApiResponseGetLineage(PydanticModel):
59
59
  """
60
60
 
61
61
  data: t.Dict[str, t.List[str]]
62
+
63
+
64
+ class ApiResponseGetColumnLineage(PydanticModel):
65
+ """
66
+ Response from the SQLMesh API for the get_column_lineage endpoint.
67
+ """
68
+
69
+ data: t.Dict[str, t.Dict[str, LineageColumn]]
sqlmesh/lsp/main.py CHANGED
@@ -4,6 +4,7 @@
4
4
  import logging
5
5
  import typing as t
6
6
  from pathlib import Path
7
+ import urllib.parse
7
8
 
8
9
  from lsprotocol import types
9
10
  from pygls.server import LanguageServer
@@ -14,6 +15,7 @@ from sqlmesh.core.linter.definition import AnnotatedRuleViolation
14
15
  from sqlmesh.lsp.api import (
15
16
  API_FEATURE,
16
17
  ApiRequest,
18
+ ApiResponseGetColumnLineage,
17
19
  ApiResponseGetLineage,
18
20
  ApiResponseGetModels,
19
21
  )
@@ -24,7 +26,7 @@ from sqlmesh.lsp.reference import (
24
26
  get_references,
25
27
  )
26
28
  from sqlmesh.lsp.uri import URI
27
- from web.server.api.endpoints.lineage import model_lineage
29
+ from web.server.api.endpoints.lineage import column_lineage, model_lineage
28
30
  from web.server.api.endpoints.models import get_models
29
31
 
30
32
 
@@ -92,18 +94,37 @@ class SQLMeshLanguageServer:
92
94
  @self.server.feature(API_FEATURE)
93
95
  def api(
94
96
  ls: LanguageServer, request: ApiRequest
95
- ) -> t.Union[ApiResponseGetModels, ApiResponseGetLineage]:
97
+ ) -> t.Union[ApiResponseGetModels, ApiResponseGetLineage, ApiResponseGetColumnLineage]:
96
98
  ls.log_trace(f"API request: {request}")
97
99
  if self.lsp_context is None:
98
100
  raise RuntimeError("No context found")
99
- if request.url == "/api/models":
100
- response = ApiResponseGetModels(data=get_models(self.lsp_context.context))
101
- return response
102
- if request.url.startswith("/api/lineage"):
103
- name = request.url.split("/")[-1]
104
- lineage = model_lineage(name, self.lsp_context.context)
105
- non_set_lineage = {k: v for k, v in lineage.items() if v is not None}
106
- return ApiResponseGetLineage(data=non_set_lineage)
101
+
102
+ parsed_url = urllib.parse.urlparse(request.url)
103
+ path_parts = parsed_url.path.strip("/").split("/")
104
+
105
+ if request.method == "GET":
106
+ if path_parts == ["api", "models"]:
107
+ # /api/models
108
+ return ApiResponseGetModels(data=get_models(self.lsp_context.context))
109
+
110
+ if path_parts[:2] == ["api", "lineage"]:
111
+ if len(path_parts) == 3:
112
+ # /api/lineage/{model}
113
+ model_name = urllib.parse.unquote(path_parts[2])
114
+ lineage = model_lineage(model_name, self.lsp_context.context)
115
+ non_set_lineage = {k: v for k, v in lineage.items() if v is not None}
116
+ return ApiResponseGetLineage(data=non_set_lineage)
117
+
118
+ if len(path_parts) == 4:
119
+ # /api/lineage/{model}/{column}
120
+ model_name = urllib.parse.unquote(path_parts[2])
121
+ column = urllib.parse.unquote(path_parts[3])
122
+ logging.info(f"Column lineage request: {model_name} {column}")
123
+ column_lineage_response = column_lineage(
124
+ model_name, column, False, self.lsp_context.context
125
+ )
126
+ return ApiResponseGetColumnLineage(data=column_lineage_response)
127
+
107
128
  raise NotImplementedError(f"API request not implemented: {request.url}")
108
129
 
109
130
  @self.server.feature(types.TEXT_DOCUMENT_DID_OPEN)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlmesh
3
- Version: 0.184.2.dev1
3
+ Version: 0.184.2.dev2
4
4
  Summary: Next-generation data transformation framework
5
5
  Author-email: "TobikoData Inc." <engineering@tobikodata.com>
6
6
  License: Apache License
@@ -1,5 +1,5 @@
1
1
  sqlmesh/__init__.py,sha256=DRovDXI-9D9xeYDP7t8Fq7mI31S2btlN-LHPOK3y7PA,7240
2
- sqlmesh/_version.py,sha256=J69cUN88BHtqUGrpQeggDRwXVan4Pdnn3EHekxw9Vm4,528
2
+ sqlmesh/_version.py,sha256=K1tcpWduhkaFG48YpByt7_MBd5gAWPAjrzyTLfzW7Wc,528
3
3
  sqlmesh/magics.py,sha256=9oY1Uz8uwsuTtPRg9HTYDxnGiJ7-OVRCpmCgAhbKHUU,39431
4
4
  sqlmesh/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  sqlmesh/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -155,11 +155,11 @@ sqlmesh/integrations/github/cicd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
155
155
  sqlmesh/integrations/github/cicd/command.py,sha256=a48qtSeRM7RD3IeydJwHLAZBHRbmFdA7uHh7Yhe5a74,11301
156
156
  sqlmesh/integrations/github/cicd/config.py,sha256=qEy0mRfPYJw1pm68UK0v1_4kZBj5QodnpIsOZ8JjZro,1838
157
157
  sqlmesh/integrations/github/cicd/controller.py,sha256=AiEMsRW4WSVxXP_7oQSIdzBzmYPxfYDgYeOYRk9sfJA,41388
158
- sqlmesh/lsp/api.py,sha256=Ls7BjrPSovvOu6VU_eFR0_nHcbsQl020eJvGbdWi7s8,1957
158
+ 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/main.py,sha256=cGh2AtCvmHPYV4uCBAVVfxZgtq50W6UmAaUCsMyYYoc,16011
162
+ sqlmesh/lsp/main.py,sha256=EgYQRk8s4W4PaIzUkiEKBKkXxkeWNvGLLQHDxJIPDSs,17024
163
163
  sqlmesh/lsp/reference.py,sha256=MiTnNmaGrVs1Scms3jHkZ89Cu8_ZLJGAHcs1LRywFdU,8129
164
164
  sqlmesh/lsp/uri.py,sha256=mvSLbZGmMTHPpliThOtVWiFcHnfJzp1w39q9l-xD2SI,802
165
165
  sqlmesh/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -267,7 +267,7 @@ sqlmesh/utils/pandas.py,sha256=uKI-ygEtMcGDRzXdBu0RkGmMBkYxwu5O2Wabho841Ls,2196
267
267
  sqlmesh/utils/pydantic.py,sha256=-u69PDY-4FLR7ODNKBoN7PsPNmZ0wdhsJcCAG2P6vyY,11061
268
268
  sqlmesh/utils/rich.py,sha256=xNZyPCqEc4TAlJlsEthg-5eYUWpaizz0QjBzO7a1Yv4,1509
269
269
  sqlmesh/utils/yaml.py,sha256=np-WVcwmwsKghCgAj1OBBMsK1SXSRn4wR-H37cGiFr8,2282
270
- sqlmesh-0.184.2.dev1.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
270
+ sqlmesh-0.184.2.dev2.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
271
271
  web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
272
272
  web/client/dist/index.html,sha256=f4Pg8Cex2Yzuh8nwt5XduYLO41HKza9RIL0rW1d9wKw,5472
273
273
  web/client/dist/assets/Audits-DF7amJxU.js,sha256=VxuJ7bKHmPaqK8SvZaqdeSB_m9-oI7fi6HND54mJ4Y0,1041
@@ -379,14 +379,14 @@ web/server/api/endpoints/directories.py,sha256=Aa8U4pTs3Saj5DnJ9TDnX9mZois-EXgpc
379
379
  web/server/api/endpoints/environments.py,sha256=g3YC6j4LLlG_wjJqn-Hrz78BWmgS7vhUhzaycsiez00,2124
380
380
  web/server/api/endpoints/events.py,sha256=tjhOhGe9jt7L1mOLLapl5qTvicDRnP5lPZHSq9OnSVI,932
381
381
  web/server/api/endpoints/files.py,sha256=UnZPScF-HANNNZhNFhxfAPihcU3p85mB7P2rqFc2wG4,6698
382
- web/server/api/endpoints/lineage.py,sha256=RdK1QmNhgVU6dkfEcgdSLnko1SkGQhJP_IgeDWRJ4vM,5775
382
+ web/server/api/endpoints/lineage.py,sha256=re2mNADlUQsBZVeA7jKw857mQvMxwijynP5iVB7YAnY,5769
383
383
  web/server/api/endpoints/meta.py,sha256=QKWWrHewGh5JS8mCSWXTKCIQwXw-TQfaT9tWt_SsNY4,1032
384
384
  web/server/api/endpoints/models.py,sha256=SzS5bshzdXyM6hb948sZ_3k-xhpGCHkxkb7pHzPjM_o,4675
385
385
  web/server/api/endpoints/modules.py,sha256=8hqqgonGay_mJmpCw0IdbjsPhWlQH2VLdKAqha-myac,468
386
386
  web/server/api/endpoints/plan.py,sha256=OYuQ_4dgbhG9ibTcX1a8mvYgH3ANxw9Fhbb4wg6QWqc,9222
387
387
  web/server/api/endpoints/table_diff.py,sha256=Wd5YxeKbZB7AkrDvqFgvV9ZQlnKYOF1n5W_w2EHE_Zw,2085
388
- sqlmesh-0.184.2.dev1.dist-info/METADATA,sha256=wrEfzrsZSWnACw61vDx3t02IDyKkOmP6wB-9_UvkJDw,25498
389
- sqlmesh-0.184.2.dev1.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
390
- sqlmesh-0.184.2.dev1.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
391
- sqlmesh-0.184.2.dev1.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
392
- sqlmesh-0.184.2.dev1.dist-info/RECORD,,
388
+ sqlmesh-0.184.2.dev2.dist-info/METADATA,sha256=_LtGgD1Kkkn6kxUjsFdqjqOw8wS8BO92ePAgPYbabAo,25498
389
+ sqlmesh-0.184.2.dev2.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
390
+ sqlmesh-0.184.2.dev2.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
391
+ sqlmesh-0.184.2.dev2.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
392
+ sqlmesh-0.184.2.dev2.dist-info/RECORD,,
@@ -126,7 +126,7 @@ def create_models_only_lineage_adjacency_list(
126
126
 
127
127
 
128
128
  @router.get("/{model_name:str}/{column_name:str}")
129
- async def column_lineage(
129
+ def column_lineage(
130
130
  model_name: str,
131
131
  column_name: str,
132
132
  models_only: bool = False,