Transpile Guide
Verify Installation
Verify the successful installation by executing the provided command; confirmation of a successful installation is indicated when the displayed output aligns with the example screenshot provided:
Command:
databricks labs lakebridge transpile --help
Should output:
Transpile SQL/ETL sources to Databricks-compatible code
Usage:
  databricks labs lakebridge transpile [flags]
Flags:
      --catalog-name name             (Optional) Catalog name, only used when validating converted code
      --error-file-path path          (Optional) Local path where a log of conversion errors (if any) will be written
  -h, --help                          help for transpile
      --input-source path             (Optional) Local path of the sources to be convert
      --output-folder path            (Optional) Local path where converted code will be written
      --schema-name name              (Optional) Schema name, only used when validating converted code
      --skip-validation string        (Optional) Whether to skip validating the output ('true') after conversion or not ('false')
      --source-dialect string         (Optional) The source dialect to use when performing conversion
      --transpiler-config-path path   (Optional) Local path to the configuration file of the transpiler to use for conversion
Global Flags:
      --debug            enable debug logging
  -o, --output type      output type: text or json (default text)
  -p, --profile string   ~/.databrickscfg profile
  -t, --target string    bundle target to use (if applicable)
Execution Pre-Set Up
When you run install-transpile, you will be prompted for settings to use when transpiling your sources. You can
choose to provide these at the time of installation, or to provide them later as arguments when transpiling.
The transpile command will trigger the conversion of the specified code. These settings provided during install-transpile can be overridden (or provided if unavailable) using the command-line options:
input-source: The local filesystem path to the sources that should be transpiled. This must be provided if not set duringinstall-transpile.output-folder: The local filesystem path where converted code will be written. This must be provided if not set duringinstall-transpile.source-dialect: Dialect name (ex: snowflake, oracle, datastage, etc). This must be provided if not set duringinstall-transpile.overrides-file: An optional local path to a JSON file containing custom overrides for the transpilation process, if the underlying transpiler supports this. (Refer to this documentation for more details on custom overrides.)target-technology: The target technology to use for conversion output. This must be provided if not set duringinstall-transpileand the underlying transpiler requires it for the source dialect in use.error-file-path: The path to the file where a log of conversion errors will be stored. If not provided here or duringinstall-transpileno error log will be written.skip-validation: Whether the transpiler will skip the validation of transpiled SQL sources. If not provided here or duringinstall-transpilevalidation will be attempted by default.catalog-name: The name of the catalog in Databricks to use when validating transpiled SQL sources. If not specified,remorphwill be used as the default catalog.schema-name: The name of the schema in Databricks to use when validating transpiled SQL sources. If not specified,transpilerwill be used as the default schema.transpiler-config-path: This path of the configuration file for the transpiler to use for conversion. This is normally inferred from the source dialect or chosen duringinstall-transpileif multiple transpilers support the source dialect.
Execution
Execute the below command to initialize the transpile process passing the arguments to the command directly in the call.
databricks labs lakebridge transpile --transpiler-config-path <absolute-path> --input-source <absolute-path> --source-dialect <snowflake> --output-folder <absolute-path> --skip-validation <True|False> --catalog-name <catalog name> --schema-name <schema name>
If you have configured all the required inputs at installation time, you can simply run:
databricks labs lakebridge transpile