sqlmesh 0.189.3.dev23__py3-none-any.whl → 0.189.3.dev25__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.189.3.dev23'
21
- __version_tuple__ = version_tuple = (0, 189, 3, 'dev23')
20
+ __version__ = version = '0.189.3.dev25'
21
+ __version_tuple__ = version_tuple = (0, 189, 3, 'dev25')
sqlmesh/lsp/main.py CHANGED
@@ -85,6 +85,26 @@ class SQLMeshLanguageServer:
85
85
  # Register LSP features (e.g., formatting, hover, etc.)
86
86
  self._register_features()
87
87
 
88
+ def _create_lsp_context(self, paths: t.List[Path]) -> t.Optional[LSPContext]:
89
+ """Create a new LSPContext instance using the configured context class.
90
+
91
+ On success, sets self.lsp_context and returns the created context.
92
+
93
+ Args:
94
+ paths: List of paths to pass to the context constructor
95
+
96
+ Returns:
97
+ A new LSPContext instance wrapping the created context, or None if creation fails
98
+ """
99
+ try:
100
+ context = self.context_class(paths=paths)
101
+ lsp_context = LSPContext(context)
102
+ self.lsp_context = lsp_context
103
+ return lsp_context
104
+ except Exception as e:
105
+ self.server.log_trace(f"Error creating context: {e}")
106
+ return None
107
+
88
108
  def _register_features(self) -> None:
89
109
  """Register LSP features on the internal LanguageServer instance."""
90
110
 
@@ -116,16 +136,9 @@ class SQLMeshLanguageServer:
116
136
  for ext in ("py", "yml", "yaml"):
117
137
  config_path = folder_path / f"config.{ext}"
118
138
  if config_path.exists():
119
- try:
120
- # Use user-provided instantiator to build the context
121
- created_context = self.context_class(paths=[folder_path])
122
- self.lsp_context = LSPContext(created_context)
139
+ if self._create_lsp_context([folder_path]):
123
140
  loaded_sqlmesh_message(ls, folder_path)
124
141
  return # Exit after successfully loading any config
125
- except Exception as e:
126
- ls.log_trace(
127
- f"Error loading context from {config_path}: {e}",
128
- )
129
142
  except Exception as e:
130
143
  ls.log_trace(
131
144
  f"Error initializing SQLMesh context: {e}",
@@ -288,13 +301,8 @@ class SQLMeshLanguageServer:
288
301
 
289
302
  # Reload the entire context and create a new LSPContext
290
303
  if self.lsp_context is not None:
291
- try:
292
- new_context = Context(paths=list(self.lsp_context.context.configs))
293
- new_full_context = LSPContext(new_context)
294
- self.lsp_context = new_full_context
304
+ if self._create_lsp_context(list(self.lsp_context.context.configs)):
295
305
  return
296
- except Exception as e:
297
- pass
298
306
 
299
307
  context = self._context_get_or_load(uri)
300
308
  models = context.map[uri.to_path()]
@@ -664,29 +672,18 @@ class SQLMeshLanguageServer:
664
672
  for ext in ("py", "yml", "yaml"):
665
673
  config_path = folder_uri / f"config.{ext}"
666
674
  if config_path.exists():
667
- try:
668
- created_context = self.context_class(paths=[folder_uri])
669
- self.lsp_context = LSPContext(created_context)
675
+ if self._create_lsp_context([folder_uri]):
670
676
  loaded_sqlmesh_message(self.server, folder_uri)
671
677
  return
672
- except Exception as e:
673
- self.server.show_message(f"Error loading context: {e}", types.MessageType.Error)
674
678
 
675
679
  # If not found in the provided folder, search through all workspace folders
676
680
  for workspace_folder in self.workspace_folders:
677
681
  for ext in ("py", "yml", "yaml"):
678
682
  config_path = workspace_folder / f"config.{ext}"
679
683
  if config_path.exists():
680
- try:
681
- created_context = self.context_class(paths=[workspace_folder])
682
- self.lsp_context = LSPContext(created_context)
684
+ if self._create_lsp_context([workspace_folder]):
683
685
  loaded_sqlmesh_message(self.server, workspace_folder)
684
686
  return
685
- except Exception as e:
686
- self.server.show_message(
687
- f"Error loading context from {config_path}: {e}",
688
- types.MessageType.Warning,
689
- )
690
687
 
691
688
  def _ensure_context_for_document(
692
689
  self,
@@ -713,17 +710,10 @@ class SQLMeshLanguageServer:
713
710
  for ext in ("py", "yml", "yaml"):
714
711
  config_path = path / f"config.{ext}"
715
712
  if config_path.exists():
716
- try:
717
- # Use user-provided instantiator to build the context
718
- created_context = self.context_class(paths=[path])
719
- self.lsp_context = LSPContext(created_context)
713
+ if self._create_lsp_context([path]):
720
714
  loaded = True
721
715
  # Re-check context for the document now that it's loaded
722
716
  return self._ensure_context_for_document(document_uri)
723
- except Exception as e:
724
- self.server.show_message(
725
- f"Error loading context: {e}", types.MessageType.Error
726
- )
727
717
  path = path.parent
728
718
 
729
719
  # If still no context found, try the workspace folders
@@ -732,16 +722,9 @@ class SQLMeshLanguageServer:
732
722
  for ext in ("py", "yml", "yaml"):
733
723
  config_path = workspace_folder / f"config.{ext}"
734
724
  if config_path.exists():
735
- try:
736
- created_context = self.context_class(paths=[workspace_folder])
737
- self.lsp_context = LSPContext(created_context)
725
+ if self._create_lsp_context([workspace_folder]):
738
726
  loaded_sqlmesh_message(self.server, workspace_folder)
739
727
  return
740
- except Exception as e:
741
- self.server.show_message(
742
- f"Error loading context from {config_path}: {e}",
743
- types.MessageType.Warning,
744
- )
745
728
 
746
729
  return
747
730
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlmesh
3
- Version: 0.189.3.dev23
3
+ Version: 0.189.3.dev25
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=QjwaamJIdW7voXoS880yAx7tHm-Im4_mqGA-XJgafos,7631
2
- sqlmesh/_version.py,sha256=8CXQaUN3xs2BDSJa0E379UHRu35lJWlvV46mzmTJDas,530
2
+ sqlmesh/_version.py,sha256=37EEYiPKjKLRjgTJuVS4Wg99HR84lqpvQuOP5ezAfYY,530
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
@@ -165,7 +165,7 @@ sqlmesh/lsp/custom.py,sha256=40ekRrcsJ-lsF4-uPs4mo8CFegTWK_zKzi4am_NO9oo,2196
165
165
  sqlmesh/lsp/description.py,sha256=4QIGC9ix8IzmWF6DVUNhY4m1Crk3sNQA6hZ1RbyqU78,827
166
166
  sqlmesh/lsp/helpers.py,sha256=igzUgeYAO3LUZFr3qN4l9hzztOy66lRubX93KtCMduY,654
167
167
  sqlmesh/lsp/hints.py,sha256=j-blccBUil94yRoDjWfkSM0HqMmsKD6hP2TaWdWWVk4,3734
168
- sqlmesh/lsp/main.py,sha256=QpwMayubrXIgapAWuiGtkW_RTrcvvo_8qA8-IpGVG0I,36375
168
+ sqlmesh/lsp/main.py,sha256=-rthyo8sdcUHVEq0PY8DuvhydIldnY0vU3A5pckKjEE,35061
169
169
  sqlmesh/lsp/reference.py,sha256=2rAYfwrKRfxlYA3psTDLacxYWvuFaouMyS7plOSYHiQ,23883
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.189.3.dev23.dist-info/licenses/LICENSE,sha256=OlMefUjgWJdULtf84BLW0AZZcY8DwdgQqb_1j2862j8,11346
278
+ sqlmesh-0.189.3.dev25.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.189.3.dev23.dist-info/METADATA,sha256=kd0zF-aJOVknI2DofNu_xtKe69RIqk9nf7smomJyBG8,26541
397
- sqlmesh-0.189.3.dev23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
398
- sqlmesh-0.189.3.dev23.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
399
- sqlmesh-0.189.3.dev23.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
400
- sqlmesh-0.189.3.dev23.dist-info/RECORD,,
396
+ sqlmesh-0.189.3.dev25.dist-info/METADATA,sha256=twmYVsbHpXYrhLnXUzU7Ts_K5JEXRhd6CvowduU2N-Y,26541
397
+ sqlmesh-0.189.3.dev25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
398
+ sqlmesh-0.189.3.dev25.dist-info/entry_points.txt,sha256=pIYKtg-u-uO7BK_Y0qrdmfyj0bYrcMc3Xiqr5WE3VFk,121
399
+ sqlmesh-0.189.3.dev25.dist-info/top_level.txt,sha256=bspjo5vjELQkuN0qKuTFIbsrUt3Zeo8D2mlKeHG1LdE,12
400
+ sqlmesh-0.189.3.dev25.dist-info/RECORD,,