Skip to content

Commit 1e10b60

Browse files
added flag to fail if users use regular transpile after installing switch
1 parent fab0e87 commit 1e10b60

File tree

1 file changed

+8
-4
lines changed
  • src/databricks/labs/lakebridge

1 file changed

+8
-4
lines changed

src/databricks/labs/lakebridge/cli.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,20 @@ def _validate_transpiler_config_path(transpiler_config_path: str, msg: str) -> N
235235
def use_transpiler_config_path(self, transpiler_config_path: str | None) -> None:
236236
if transpiler_config_path is not None:
237237
logger.debug(f"Setting transpiler_config_path to: {transpiler_config_path!r}")
238-
# Switch is installed inside "/Users/<>/.lakebridge/transpilers/Switch/lsp/config.yml
239-
if Path(transpiler_config_path).parent.parent.name == "Switch":
240-
msg = "Switch transpiler is not supported through `transpile` run `llm-transpile` instead."
241-
raise_validation_exception(msg)
242238
self._validate_transpiler_config_path(
243239
transpiler_config_path,
244240
f"Invalid path for '--transpiler-config-path', does not exist: {transpiler_config_path}",
245241
)
246242
self._config = dataclasses.replace(self._config, transpiler_config_path=transpiler_config_path)
247243

244+
# Switch is installed inside "/Users/<>/.lakebridge/transpilers/Switch/lsp/config.yml
245+
if (
246+
self._config.transpiler_config_path is not None
247+
and Path(self._config.transpiler_config_path).parent.parent.name == "Switch"
248+
):
249+
msg = "Switch transpiler is not supported through `transpile` run `llm-transpile` instead."
250+
raise RuntimeError(msg)
251+
248252
def use_source_dialect(self, source_dialect: str | None) -> None:
249253
if source_dialect is not None:
250254
# Defer validation: depends on the transpiler config path, we'll deal with this later.

0 commit comments

Comments
 (0)