### Teradata Recon Config Example Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/reconcile/configuration.mdx Example configuration for reconciling data from Teradata. Requires a UDF to be installed on the source for row-level reconciliation. ```yaml source: dialect: teradata catalog: DBC schema: lakebridge_test uc_connection_name: teradata_sandbox target: catalog: migrated schema: migrated report_type: all ``` -------------------------------- ### Install Documentation Dependencies Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/dev/index.mdx Installs the necessary dependencies for the Lakebridge documentation. ```bash make docs-install ``` -------------------------------- ### SQL Splitter Example Command Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/sql_splitter.mdx An example command to run the SQL Splitter. It specifies an input SQL file and an output directory that must exist prior to execution. ```bash ./sqlsplit -i /project1/inputs/all_objects.sql -o /path/to/output ``` -------------------------------- ### Complete Custom Configuration File Example Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/bladebridge/bladebridge_configuration.mdx This example demonstrates a complete custom configuration file ('my_custom_config.json') that includes inheritance, a target SQL file header, and schema replacements for transpilation. ```json { "inherit_from": [ "/Users/user.name/.databricks/labs/remorph-transpilers/bladebridge/lib/.venv/lib/python3.10/site-packages/databricks/labs/bladebridge/Converter/Configs/base_mssql2databricks_sql.json" ], "target_sql_file_header": "USE CATALOG catalog01;", "line_subst": [ { "from": "\\bschema01\\b\\.", "to": "gold." }, { "from": "\\bschema02\\b\\.", "to": "silver." } ] } ``` -------------------------------- ### Run Lakebridge Profiler Dashboard Installation Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/assessment/profiler/dashboards/index.mdx Execute the interactive command to install the profiler dashboard. This command guides you through prompts to configure the installation. ```bash databricks labs lakebridge visualize-profiler-results ``` -------------------------------- ### Install Lakebridge Transpile Component Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/installation.mdx Install the transpiler component for Lakebridge. ```bash databricks labs lakebridge install-transpile ``` -------------------------------- ### Manual Transpiler Version JSON Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/index.mdx Example JSON content for the version.json file used in manual transpiler installations. ```json {"version": "v1.3.7", "date": "2025-03-17-15:02:31Z"} ``` -------------------------------- ### Install Databricks CLI on Windows Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/installation.mdx Download and run the Databricks CLI installation script on Windows. ```shell curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/v0.299.0/install.sh ``` -------------------------------- ### Install Transpile with LLM Transpiler Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/installation.mdx Install the transpiler, including the LLM transpiler, for Lakebridge. ```bash databricks labs lakebridge install-transpile --include-llm-transpiler true ``` -------------------------------- ### Install Switch LLM Transpiler Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/switch/index.mdx Install the Switch transpiler using the `install-transpile` command with the `--include-llm-transpiler` option. This command uploads necessary notebooks and creates a Databricks Job for conversions. ```bash databricks labs lakebridge install-transpile --include-llm-transpiler true --profile profile_name ``` -------------------------------- ### JVM Proxy Configuration Example Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/dev/contributing.md Example of the .databricks-login.json file required for the JVM proxy. Ensure this file is created with your workspace profile and cluster ID. ```json { "workspace_profile": "labs-azure-tool", "cluster_id": "0708-200540-wcwi4i9e" } ``` -------------------------------- ### Install Databricks CLI on Linux Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/faq.mdx Installs the Databricks CLI on Linux systems using apt package manager. Ensure curl, sudo, and unzip are installed before running. ```bash #!/usr/bin/env bash apt update && apt install -y curl sudo unzip curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/v0.299.0/install.sh | sudo sh ``` -------------------------------- ### Set up Development Environment Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/dev/contributing.md Command to set up the development environment for the project. This command installs all necessary libraries and project dependencies into a virtual environment named .venv. ```shell make dev ``` -------------------------------- ### Install Yarn with Homebrew Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/dev/index.mdx Installs Node.js and Yarn globally on macOS using Homebrew. ```bash brew install node npm install --global yarn ``` -------------------------------- ### Transpile with Default Configuration Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/index.mdx Run the transpile process using pre-configured inputs from the installation. This is a simplified command for environments where all settings are already defined. ```bash databricks labs lakebridge transpile ``` -------------------------------- ### Verify Lakebridge Analyzer Installation Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/assessment/analyzer/index.mdx Execute this command to verify the Lakebridge Analyzer installation. Successful installation is confirmed when the output matches the expected help information. ```bash databricks labs lakebridge analyze --help ``` ```console Analyze existing non-Databricks database or ETL sources Usage: databricks labs lakebridge analyze [flags] Flags: --generate-json true|false (Optional) Generate JSON file alongside the Excel report -h, --help help for analyze --report-file path (Optional) Local filesystem path of the analysis report file to write --source-directory path (Optional) Local filesystem path of a directory containing sources to analyze --source-tech string (Optional) The technology/platform of the sources to analyze 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) ``` -------------------------------- ### Configure MSSQL Connection Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/assessment/profiler/mssql.mdx Run this command to initiate the MSSQL profiler connection setup. Follow the interactive prompts to provide connection details. ```console databricks labs lakebridge configure-database-profiler Please select the source system you want to configure [0] synapse [1] mssql Enter a number between 0 and 1: 1 (local | env) local means values are read as plain text env means values are read from environment variables, and fall back to plain text if not variable is not found Enter secret vault type (local | env) [0] env [1] local Enter a number between 0 and 1: 1 Enter fetch size (default: 1000): Enter login timeout (seconds) (default: 30): Enter the fully-qualified server name: my-server.database.windows.net Enter the port details: 1433 Enter the database name: MyAppDB Enter the SQL username: profiler_user Enter the SQL password: Trust server certificate (default: no): Enter timezone (e.g. America/New_York) (default: UTC): Enter the ODBC driver installed locally (default: ODBC Driver 18 for SQL Server): Do you want to test the connection to mssql? (yes/no): yes ``` -------------------------------- ### Install Lakebridge Reconcile using PyPI Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/reconcile/running.mdx Install the Lakebridge library within a Databricks notebook environment using pip. Restart the Python environment after installation. ```python %pip install databricks-labs-lakebridge dbutils.library.restartPython() ``` -------------------------------- ### Verify Lakebridge Installation Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/installation.mdx Check the Lakebridge installation by running the help command. ```bash databricks labs lakebridge --help ``` -------------------------------- ### Install Lakebridge Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/installation.mdx Install the Lakebridge package using the Databricks CLI. ```bash databricks labs install lakebridge ``` -------------------------------- ### Sample Perl Implementation for init_hooks Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/bladebridge/bladebridge_configuration.mdx Example Perl subroutine to handle the initialization hook. It receives configuration entries and the converter instance, printing them for debugging. ```perl sub init_hooks { my $param = shift; %CFG = %{$param->{CONFIG}}; $CONVERTER = $param->{CONVERTER}; print "INIT_HOOKS Called. config:\n" . Dumper(%CFG); } ``` -------------------------------- ### MS SQL Server Recon Config Example Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/reconcile/configuration.mdx Example configuration for reconciling data from MS SQL Server. Includes source dialect, connection name, and target details. ```yaml source: dialect: mssql uc_connection_name: example_connection_mssql target: catalog: migrated schema: migrated report_type: data ``` -------------------------------- ### Install uv using Homebrew Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/dev/contributing.md Command to install the 'uv' package manager using Homebrew. This is a prerequisite for setting up the Python development environment. ```shell brew install uv ``` -------------------------------- ### Configure Snowflake Profiler Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/assessment/profiler/snowflake.mdx Run this command to start the configuration process for the Snowflake profiler. You will be prompted to select 'snowflake' and provide connection details. ```bash databricks labs lakebridge configure-database-profiler ``` -------------------------------- ### CREATE TABLE LIKE - Redshift Syntax Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/source_systems/redshift.mdx Example of creating a table like another table in Redshift SQL, including default values. ```sql CREATE TABLE customers_backup (LIKE customers INCLUDING DEFAULTS); ``` -------------------------------- ### Profiler Dashboard Installation Prompts Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/assessment/profiler/dashboards/index.mdx Interactive prompts shown during the profiler dashboard installation. These prompts allow you to configure the installation, including overriding existing deployments and specifying data sources and catalog details. ```console # Shown only when a profiler dashboard is already installed Do you want to override the existing installation? [y/n]: Enter the source tech: [synapse] Enter the path to the profiler extract file: [/tmp/data/synapse_assessment/profiler_extract.db] Enter catalog name [remorph]: Enter schema name [profiler]: Enter volume name [ingestion_volume]: # Shown if the catalog does not exist Catalog `` doesn't exist. Create it? [y/n]: # Shown if the schema does not exist in the catalog Schema `` doesn't exist in catalog ``. Create it? [y/n]: # Shown if the volume does not exist in the catalog and schema Volume `` doesn't exist in catalog `` and schema ``. Create it? [y/n]: ``` -------------------------------- ### Install Databricks CLI on MacOS Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/installation.mdx Use Homebrew to install the Databricks CLI on macOS. ```shell brew tap databricks/tap brew install databricks ``` -------------------------------- ### Oracle Recon Config Example Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/reconcile/configuration.mdx Example configuration for reconciling data from Oracle. Specifies the source dialect, connection name, and target catalog/schema. ```yaml source: dialect: oracle uc_connection_name: example_connection_oracle target: catalog: migrated schema: migrated report_type: data ``` -------------------------------- ### Install Lakebridge with a Specific Profile Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/installation.mdx Install Lakebridge using a specific Databricks CLI profile. ```bash databricks labs install lakebridge --profile ``` -------------------------------- ### Configure Lakebridge Reconcile Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/reconcile/index.mdx Run this command to set up Lakebridge workspace resources. See Installation for details. ```bash databricks labs lakebridge configure-reconcile ``` -------------------------------- ### Configure BigQuery Connection Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/assessment/profiler/bigquery.mdx Run this command to start the interactive configuration process for BigQuery. You will be prompted to enter connection details, lookback window, and other profiler settings. The configuration is saved to `~/.databricks/labs/lakebridge/.credentials.yml`. ```console databricks labs lakebridge configure-database-profiler Please select the source system you want to configure [0] bigquery [1] mssql [2] synapse Enter a number between 0 and 2: 0 (local | env) local means values are read as plain text env means values are read from environment variables, and fall back to plain text if not variable is not found Enter secret vault type (local | env) [0] env [1] local Enter a number between 0 and 1: 1 Please provide BigQuery connection settings: Enter BigQuery project and region pairs (Format: comma-separated project.region. Example: my-proj-a.us, my-proj-b.eu-west-1): customer-prod-1.us, customer-admin.us Enter lookback window in days to profile (default: 180): Enter max parallel SQLs per (project, region) iteration (default: 8): Please configure profiler settings: Exclude reservations and commitments data? (default: no): Exclude streaming and write API summary? (default: no): ``` -------------------------------- ### Example Function Call with Arguments Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/bladebridge/bladebridge_configuration.mdx Illustrates how arguments are represented within a function call like SUBSTR, showing positional mapping for 'arg $1', 'arg $2', and 'arg $3'. ```sql SELECT SUBSTR( UPPER( first_name || ' ' last_name ), -- arg $1 10, -- arg $2 20 -- arg $3 ) ``` -------------------------------- ### Configure ReconcileConfig Properties Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/reconcile/running.mdx Example configuration for ReconcileConfig, specifying source and target connection details, and metadata storage. ```python reconcile_config = ReconcileConfig( report_type="all", source=SourceConnectionConfig( dialect="snowflake", catalog="source_sf_catalog", schema="source_sf_schema", uc_connection_name="source_connection_name" ), target=TargetConnectionConfig( catalog="target_databricks_catalog", schema="target_databricks_schema", ), metadata_config = ReconcileMetadataConfig( catalog = "lakebridge_metadata", schema= "reconcile" ), ) ``` -------------------------------- ### Verify Python and Java Installation Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/installation.mdx Run these commands in your terminal to check if Python and Java are installed and accessible. ```bash python -V java -version ``` -------------------------------- ### Execute BigQuery Profiler Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/assessment/profiler/bigquery.mdx Run this command to start the BigQuery profiler. It connects to BigQuery using the configured settings and generates analysis tables in a local DuckDB database. ```bash databricks labs lakebridge execute-database-profiler --source-tech bigquery ``` -------------------------------- ### Redshift Profiler Configuration Example Transcript Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/assessment/profiler/redshift.mdx Illustrative transcript showing the prompts and inputs required during the Redshift profiler configuration process, including source selection and authentication details. ```console databricks labs lakebridge configure-database-profiler Please select the source system you want to configure [0] redshift_provisioned [1] redshift_provisioned_multi_az [2] redshift_serverless ... Enter a number ...: 0 Redshift authentication: sql_authentication or iam. Authentication type [0] iam [1] sql_authentication Enter a number between 0 and 1: 1 Credential source (local | env | file) [0] local [1] env [2] file ... Enter the Redshift cluster endpoint (host): mycluster.abc123.us-east-1.redshift.amazonaws.com Enter the port details (default: 5439): 5439 Enter the database name: dev Enter the user details: profiler_reader Enter the password details: ******** Do you want to test the connection to redshift? [y/n]: y ``` -------------------------------- ### Databricks Recon Config Example Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/reconcile/configuration.mdx Example configuration for reconciling data within Databricks. Specifies source catalog and schema, and target details. ```yaml source: dialect: databricks catalog: hive_metastore schema: hr target: catalog: migrated schema: migrated ... report_type: data ``` -------------------------------- ### Run Tests Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/dev/contributing.md Command to run the project's tests. This is used to verify the installation and the integrity of the codebase. ```shell make test ``` -------------------------------- ### Successful Transpile Output Header Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/morpheus/index.mdx Example of a header comment in a successfully transpiled SQL file, indicating the source file path. ```sql /* Successfully transpiled from /path/to/input/my_proc.sql */ CREATE PROCEDURE ... ``` -------------------------------- ### CREATE VIEW - Redshift Syntax Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/source_systems/redshift.mdx Example of a CREATE VIEW statement in Redshift SQL, demonstrating string concatenation and date difference calculation. ```sql CREATE VIEW active_customers AS SELECT customer_id, first_name || ' ' || last_name AS full_name, email, DATEDIFF(year, birth_date, CURRENT_DATE) AS age FROM customers WHERE status = 'active'; ``` -------------------------------- ### Example Workflow JSON Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/source_systems/datastage.mdx This JSON defines a sample Databricks workflow with three tasks: Extract_Data, Transform_Data, and Send_Notification, illustrating task dependencies and execution. ```json { "name": "SEQX_ETL_DAILY_LOAD", "tasks": [ { "task_key": "Extract_Data", "notebook_task": { "notebook_path": "/Workspace/Jobs/PXJ_EXTRACT_DATA", "source": "WORKSPACE" } }, { "task_key": "Transform_Data", "depends_on": [ { "task_key": "Extract_Data" } ], "run_if": "ALL_SUCCESS", "notebook_task": { "notebook_path": "/Workspace/Jobs/PXJ_TRANSFORM_DATA", "source": "WORKSPACE" } }, { "task_key": "Send_Notification", "depends_on": [ { "task_key": "Transform_Data" } ], "spark_python_task": { "python_file": "/Workspace/Jobs/SHELL_SEND_EMAIL.py" } } ] } ``` -------------------------------- ### Install Transpile with Custom Configuration Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/bladebridge/bladebridge_configuration.mdx When running the Bladebridge converter from Lakebridge, a custom configuration file can be supplied to the converter during the install-transpile process. Specify the path to your custom configuration file when prompted. ```bash databricks labs lakebridge install-transpile Do you want to override the existing installation? (default: no): yes Specify the config file to override the default[Bladebridge] config - press for none (default: ): /custom_2databricks.json ``` -------------------------------- ### Switch LLM Transpile Command Output Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/switch/index.mdx Example console output when running the `llm-transpile` command. It indicates file upload status, job triggering, and provides a URL to monitor the asynchronous Switch LLM transpilation job. ```console INFO [d.l.l.transpiler.switch_runner] Uploading /local/path/to/input to your_volume INFO [d.l.l.transpiler.switch_runner] Upload complete: your_volume/input-xyz INFO [d.l.l.transpiler.switch_runner] Triggering Switch job with job_id: INFO [d.l.l.transpiler.switch_runner] Switch LLM transpilation job started: https://workspace.databricks.com/jobs/switch_job_id/runs/run_id ``` -------------------------------- ### Serve Documentation in Development Mode Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/dev/index.mdx Runs the documentation development server, enabling live reloading for quick previews. ```bash make docs-serve-dev ``` -------------------------------- ### Custom Conversion Prompt YAML Structure Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/switch/customizing_switch.mdx Define custom conversion prompts using a YAML file. Include system messages for conversion instructions and optional few-shot examples to guide the LLM. The system message can include placeholders for comment language and common guidelines. ```yaml system_message: | Convert SQL code to Python code that runs on Databricks according to the following instructions: # Input and Output - Input: A single SQL file containing one or multiple T-SQL statements - Output: Python code with Python comments (in {comment_lang}) explaining the code ${common_python_instructions_and_guidelines} # Additional Instructions 1. Convert SQL queries to spark.sql() format 2. Add clear Python comments explaining the code 3. Use DataFrame operations instead of loops when possible 4. Handle errors using try-except blocks few_shots: - role: user content: | SELECT name, age FROM users WHERE active = 1; - role: assistant content: | # Get names and ages of active users active_users = spark.sql(""" SELECT name, age FROM users WHERE active = 1 """) display(active_users) ``` -------------------------------- ### Review and Auto-configure Tables with Python Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/reconcile/running.mdx This Python code demonstrates the recommended flow: first discover tables, then curate the discovered list in memory before applying auto-configuration. ```python discovered = discover_tables(reconcile_config=reconcile_config, spark=spark) # Review/curate in memory — or save the file, edit it in the workspace, and load it back. curated = TableRecon(tables=[t for t in discovered.tables if t.source_name != "audit_log"]) table_recon = auto_configure_tables(curated, reconcile_config=reconcile_config, spark=spark) ``` -------------------------------- ### Serve Documentation for Search Testing Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/dev/index.mdx Runs the documentation server for testing search functionality. Note that local search is not available in the development server. ```bash make docs-serve ``` -------------------------------- ### Build Documentation Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/dev/index.mdx Builds the static documentation site. This command also checks for unresolved links. ```bash make docs-build ``` -------------------------------- ### Configure Legacy Synapse Connection CLI Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/assessment/profiler/legacy_synapse.mdx Run this command to initiate the interactive configuration process for connecting to a legacy Synapse SQL pool. Follow the prompts to enter connection details. ```console databricks labs lakebridge configure-database-profiler Please select the source system you want to configure [0] synapse [1] mssql [2] legacy_synapse Enter a number between 0 and 2: 2 (local | env) local means values are read as plain text env means values are read from environment variables, and fall back to plain text if not variable is not found Enter secret vault type (local | env) [0] env [1] local Enter a number between 0 and 1: 1 Enter fetch size (default: 1000): Enter login timeout (seconds) (default: 30): Enter the fully-qualified server name: my-dw-server.database.windows.net Enter the port details: 1433 Enter the database name: my_pool Enter the SQL username: profiler_user Enter the SQL password: Trust server certificate (default: no): Enter timezone (e.g. America/New_York) (default: UTC): Enter the ODBC driver installed locally (default: ODBC Driver 18 for SQL Server): ``` -------------------------------- ### Snowflake Recon Config Example Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/reconcile/configuration.mdx Example configuration for reconciling data from Snowflake. Specifies source and target catalogs, schemas, and the report type. ```yaml source: dialect: snowflake catalog: sample_data schema: default uc_connection_name: example_connection_snowflake target: catalog: migrated schema: migrated report_type: all ``` -------------------------------- ### Lakebridge Script Debugging Output Example Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/dev/contributing.md Example output from debugging a Lakebridge script, showing log levels and script debugging information. ```text databricks labs lakebridge debug-script --name foo 21:57:42 INFO [databricks.sdk] Using Azure CLI authentication with AAD tokens 21:57:42 WARN [databricks.sdk] azure_workspace_resource_id field not provided. It is recommended to specify this field in the Databricks configuration to avoid authentication errors. Debugging script... Map(log_level -> disabled, name -> foo) ``` -------------------------------- ### BladeBridge line_subst Rule Example Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/bladebridge/bladebridge_configuration.mdx This example demonstrates a line substitution rule in BladeBridge configuration. It captures a pattern enclosed in '#' and transforms it to a different format, upcasing the captured string. ```json {"from": "#(\\w+)#", "to": "${$1}", "upcase_string": true} ``` -------------------------------- ### Execute Lakebridge Database Profiler Help Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/assessment/profiler/index.mdx View the help information for the command used to execute the profiler. This command extracts metadata and performance metrics from the source system. ```bash databricks labs lakebridge execute-database-profiler --help ``` -------------------------------- ### Execute Database Profiler with Explicit Source Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/assessment/profiler/redshift.mdx Execute the database profiler by explicitly specifying the source technology, such as 'redshift_provisioned'. ```bash databricks labs lakebridge execute-database-profiler --source-tech redshift_provisioned ``` -------------------------------- ### SQL Splitter Command-line Usage Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/sql_splitter.mdx Displays the available command-line options for the sql_splitter utility. Use this to understand how to configure input files/folders, output directories, and various processing flags. ```bash Usage: sql_splitter -h this message -i input file OR comma-separated list of files OR -d input folder -o output folder [-s] plug in newline after semicolon [-E extensions] default is sql [-t] trim lines from both sides [-b] remove square brackets [-P] do not add package variables to procedures and functions [-G pattern] custom object separator pattern [-r ] generate file and _duplicates file (or if `-r -` is specified, output to STDOUT) [-v] verbose mode ``` -------------------------------- ### Configure PyPI Mirror Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/installation.mdx Configure pip to use a local mirror for PyPI resources. This is useful for faster package installations. ```shell pip3 config --user set global.index-url https://mirror.example.com/pypi ``` -------------------------------- ### Verify Lakebridge Reconcile Command Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/installation.mdx Use this command to verify the installation and configuration of the Lakebridge reconcile feature by checking its help documentation. ```bash databricks labs lakebridge reconcile --help ``` -------------------------------- ### Profiler Command Help Output Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/assessment/profiler/index.mdx This output details the usage and flags for the 'execute-database-profiler' command, including options for specifying the source technology and output format. ```console Profile the source system database Usage: databricks labs lakebridge execute-database-profiler [flags] Flags: -h, --help help for execute-database-profiler --source-tech string (Optional) The technology/platform of the sources to Profile 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) ``` -------------------------------- ### Configure Git for GPG Signing Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/dev/contributing.md Set up your local Git environment to automatically sign commits using your GPG key. Ensure your GPG key is listed and configured globally. ```shell git config --global --unset gpg.format gpg --list-secret-keys --keyid-format=long git config --global user.signingkey git config --global commit.gpgsign true ``` -------------------------------- ### Sample Perl Implementation for prescan_code_oracle Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/bladebridge/bladebridge_configuration.mdx Example Perl subroutine for the pre-scan hook. It receives the filename and configuration, printing a message to indicate its execution. ```perl sub prescan_code_oracle { my $filename = shift; my $cf = shift; print "******** prescan_code_oracle $filename *********\n"; # Open and analyze the file... } ``` -------------------------------- ### Transpile with Full Arguments Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/index.mdx Execute the transpile process by providing all necessary arguments directly in the command. This allows for granular control over the transpilation settings. ```bash databricks labs lakebridge transpile --transpiler-config-path --input-source --source-dialect --output-folder --skip-validation --catalog-name --schema-name ``` -------------------------------- ### Run Switch LLM Transpile Command Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/switch/index.mdx Execute the `llm-transpile` command to initiate Switch conversions. This command reads local input files, uploads them to Unity Catalog Volumes, and processes them using a Databricks Job. Specify source dialect, output workspace folder, and optional catalog, schema, volume, foundation model, and configuration path. ```bash databricks labs lakebridge llm-transpile \ --input-source /local/path/to/input \ --output-ws-folder /Workspace/path/to/output \ --source-dialect mysql \ --accept-terms true \ [--catalog-name your_catalog] \ [--schema-name your_schema] \ [--volume your_volume] \ [--foundation-model your_foundation_model] \ [--switch-config-path /Workspace/path/to/switch_config.yml] \ [--profile profile_name] ``` -------------------------------- ### Transpile with Errors/Warnings Output Header Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/morpheus/index.mdx Example of a header comment for a file that failed transpilation, listing specific errors found with line and column numbers. ```sql /* Failed transpilation of /path/to/input/broken.sql The following errors were found while transpiling: - [3:5] Function GIBBERISH cannot be translated to Databricks SQL */ SELECT t1.name, GIBBERISH(t1.comment) FROM t1; ``` -------------------------------- ### Configure Hook for Pre-scanning Input Files Source: https://github.com/databrickslabs/lakebridge/blob/main/docs/lakebridge/docs/transpile/pluggable_transpilers/bladebridge/bladebridge_configuration.mdx Define a subroutine to pre-scan the input file before fragment handling. This is useful for extracting metadata like procedure parameters. ```json "prescan_and_collect_info_hook": "::prescan_code_oracle" ```