Teradata to Databricks Migration: What BladeBridge/Lakebridge Automates, and Where It Breaks
Databricks' own migration toolkit — Lakebridge, built on the BladeBridge transpiler it acquired — automates roughly 60–80% of a Teradata migration: standard SQL, functions, types, and views. The other 20–40% — stored procedures, BTEQ, and Teradata-specific constructs — is hand work. And the tool has sharp edges that will stop you cold if you run it the wrong way. Here is what converts automatically, what you rewrite, where the toolchain breaks, and the one-line workaround for when it will not install.
I have been on most sides of this move. I ran Teradata as an analytics platform at a healthcare company, adopted Databricks at a startup, spent time at Databricks itself, and now do migration work in consulting. What follows is the practitioner's version — including the failure modes the marketing pages skip.
What is BladeBridge / Lakebridge?
They are the same toolchain under two names. BladeBridge was a code-conversion company; Databricks acquired it and folded the technology into Lakebridge, the free migration toolkit distributed through Databricks Labs. Inside Lakebridge, "BladeBridge" is now the name of the mature, rule-based transpiler engine — the deterministic converter — sitting next to a newer engine and an LLM-based option. When people say a package "runs under BladeBridge," they mean the layers underneath the Lakebridge CLI wrapper.
Lakebridge is a Databricks CLI plugin that runs a Teradata (or other source) migration in three stages — analyze (score the codebase for conversion complexity), transpile (convert the SQL), and reconcile (validate source against target). You invoke it as databricks labs lakebridge <command>. It is free, and it does the mechanical bulk of the work — but it is a wrapper, and wrappers have failure modes.
What does Lakebridge convert automatically?
Most of the everyday SQL. These are the conversions the transpilers target — the functions, types, and query constructs that have clean Databricks equivalents. Treat the table as what should convert, and verify each in your output: coverage varies by engine and version, and anything the tool does not recognize passes through unchanged rather than raising an error.
| Teradata | Databricks | Notes |
|---|---|---|
NULLIFZERO(x) | NULLIF(x, 0) | Function rewrite |
ZEROIFNULL(x) | COALESCE(x, 0) | Function rewrite |
VARCHAR(n) / CHAR(n) | STRING | Type map |
INTEGER | INT | Type map |
BYTEINT | TINYINT | Type map |
QUALIFY … | QUALIFY … | Native in Databricks SQL (DBR 12+) |
SEL | SELECT | Abbreviation expanded |
| Window functions | Same | Direct equivalent |
What do you have to convert by hand?
The Teradata-specific machinery. These constructs either have no Databricks equivalent or need a different pattern entirely, and this is where a migration's real hours go.
| Teradata construct | Databricks approach |
|---|---|
SET / MULTISET tables | Drop — Delta has no row-uniqueness concept; dedup with MERGE or DISTINCT |
PRIMARY INDEX | Drop — cluster with ZORDER or liquid clustering instead |
RANGE_N partitioning | PARTITIONED BY / liquid clustering |
PERIOD data type | Two DATE/TIMESTAMP columns |
COLLECT STATISTICS | ANALYZE TABLE … COMPUTE STATISTICS |
BT / ET transactions | Remove — Delta is ACID per statement |
Cursors (DECLARE … FETCH) | Set-based MERGE / window functions |
EXECUTE IMMEDIATE (dynamic SQL) | Python: spark.sql(f"…") |
REPLACE MACRO | Views or SQL/Python functions |
BTEQ scripts (.LOGON/.EXPORT/.IF) | Notebooks / Workflows; .EXPORT → COPY INTO or DataFrame write |
The three-step workflow: analyze, transpile, reconcile
Once the CLI is installed, the flow is short:
databricks labs install lakebridge
databricks labs lakebridge install-transpile
databricks labs lakebridge analyze --source-directory ./teradata_sql --report-file ./assessment.xlsx
databricks labs lakebridge transpile --source-directory ./teradata_sql --output-directory ./databricks_sql
databricks labs lakebridge configure-reconcile
databricks labs lakebridge reconcile
analyze produces a spreadsheet that scores every file and statement from LOW to VERY_COMPLEX — read it first and triage, because it tells you exactly how big the manual tail is. transpile writes converted files mirroring your source tree. reconcile compares source and target with row counts, aggregates, and hash matching. When you drive it from a notebook, note that the dialect picker is an interactive menu (select the Teradata source dialect when prompted) — the menu number shifts between versions, so do not hardcode it. The command flags move between Lakebridge releases too — run each with --help rather than copying any guide's exact syntax, including this one.
Where the tool breaks — and how to get past it
This is the part you will not find on the product page, and it is the part that matters. Lakebridge is architected for a developer laptop talking to a workspace. Run it anywhere else — inside a locked-down cluster, behind a corporate firewall — and it fights back.
1. The install hangs on a cluster. On a managed, locked-down cluster, databricks labs install lakebridge downloads the release zipball and then stalls indefinitely at the unpack step:
Debug: Unpacking zipball to: /tmp/.databricks/labs/lakebridge/lib
[hangs — Ctrl+C required]
And a direct pip install of the package imports no better — it expects a project-root layout that a managed cluster does not have:
NotADirectoryError: Cannot find project root
2. The workaround: drop down to the engine. Under the CLI, the actual SQL dialect translation is done by an open-source Python library, sqlglot. It is the piece that does the Teradata-to-Databricks rewriting, and you can call it on its own — no wrapper, no install dance:
import sqlglot
sqlglot.transpile(
"SELECT NULLIFZERO(balance) FROM customers "
"QUALIFY ROW_NUMBER() OVER (PARTITION BY id ORDER BY dt DESC) = 1",
read="teradata", write="databricks")[0]
This is genuinely useful — it gives you dialect translation in exactly the environments where the CLI will not run. But treat the output as a draft, not a finished result. In my own testing, that very snippet came back with NULLIFZERO and the QUALIFY clause unchanged — sqlglot passed the Teradata-specific function straight through, with no warning that it had skipped it. That is the real lesson, and it applies to the whole Lakebridge pipeline: the tools convert most of what they recognize and quietly leave the rest, so the skill is not running the transpiler — it is verifying what it did and did not touch. When the tool won't install, drop to the engine; then read every line it hands back.
3. Firewalled environment: vendor the wheel. If your workspace has no path to PyPI, even pip install sqlglot fails. Commit the wheel into your repo and install it offline, deriving the repo root dynamically so it resolves for any user:
import subprocess
# wheel committed at ./wheels/sqlglot-<version>-py3-none-any.whl
subprocess.check_call(["pip", "install", wheel_path, "--quiet"])
import sqlglot # now available, no internet required
A few more landmines worth knowing before they cost you an afternoon:
- Serverless can't do it — no Web Terminal and networking limits; use Classic (Photon) compute, or just run the CLI from your laptop.
/rootpermission errors on managed clusters — setHOME=/rootand call the CLI by its absolute path when scripting it in a subprocess.- Python 3.13 breaks the installer (SSL certificate issues) — use Python 3.10–3.12 for local installs.
- Interactive prompts hang non-interactive runs — pipe answers in (
yes | …, and echo the dialect selection) when calling the CLI from a notebook. - Unity Catalog with no default storage root blocks
CREATE CATALOG— migrate into a pre-existing catalog rather than creating one.
How to replicate this on your own migration
- Get a source to practice on. If you do not have a spare Teradata system, Teradata's free ClearScape Analytics environment gives you a real instance to load DDL and data into.
- Install the Databricks CLI locally and configure it (host + token). Run Lakebridge from here, not from inside a cluster.
- Analyze first. Point
lakebridge analyzeat your SQL and read the complexity report. Triage LOW → VERY_COMPLEX so you know the size of the manual tail before you commit a timeline. - Transpile the bulk. Run
install-transpilethentranspile, selecting the Teradata dialect. Expect it to nail the standard SQL and flag the rest. - Drop to sqlglot when the wrapper won't cooperate — on a cluster, behind a firewall, or in CI. Same conversions, fewer moving parts.
- Hand-convert the VERY_COMPLEX tail using a simple loop: identify the construct, understand the intent, map it to the Databricks pattern (cursor → MERGE, dynamic SQL → Python, BTEQ → notebook), and test it against the source output.
- Move the data via Lakehouse Federation, CTAS, deep clone, or MERGE, depending on volume and cutover strategy.
- Reconcile — counts, aggregates, and hashes per table — and do not call it done until the numbers match.
- Wrap it in engineering rigor — a validation harness, asset bundles, and CI/CD. This is the step teams skip, and it is the step that separates a migration that holds from one that quietly drifts.
Where migrations actually go wrong
The failure mode is almost never the SQL the tool converts — it is the assumption that the tool converts everything. In practice a Teradata codebase splits roughly into a large majority that is straightforward, a middle band that needs real judgment, and a small but stubborn tail that is genuinely hard: recursive stored procedures, dynamic SQL, BTEQ orchestration, and the Teradata-isms with no clean Databricks analog. Automation eats the majority in an afternoon, which is exactly what lulls teams into underestimating the rest. The engagements that go sideways are the ones that budgeted for the 80% and discovered the 20% in production. The ones that go well treat the transpiler as a fast start on the easy part, and spend their real effort on the hard tail and the validation around it — because a migration is not finished when the code runs, it is finished when the numbers reconcile and a test harness keeps them that way.
Frequently asked questions
What tool does Databricks recommend for a Teradata migration?
Lakebridge, the free migration toolkit in Databricks Labs. It grew out of BladeBridge, a code-conversion company Databricks acquired; inside Lakebridge, the BladeBridge engine is the rule-based transpiler that converts Teradata SQL to Databricks SQL, alongside newer and LLM-based conversion options.
How much of a Teradata migration can be automated?
Roughly 60–80% of standard SQL, DDL, functions, and views convert automatically. The remaining 20–40% — stored procedures, BTEQ scripts, cursors, dynamic SQL, and Teradata-specific constructs like SET tables and PERIOD types — is manual rework. The automation handles volume; the value is in the tail it can't.
What is sqlglot and why call it directly?
sqlglot is an open-source Python SQL transpiler the Lakebridge toolchain relies on for dialect translation. When the Lakebridge CLI will not install — on a locked-down cluster, or behind a firewall — you can call sqlglot directly with read="teradata", write="databricks". Inspect the output, though: it passes constructs it does not recognize through unchanged, without warning.
Can you run Lakebridge on serverless compute?
Not well. Lakebridge is designed to run from a developer laptop against a workspace, and serverless lacks the Web Terminal and networking it expects. Run the CLI locally, or use Classic (Photon) compute with a Web Terminal. Trying to install it inside a managed cluster is where most people get stuck.
How do you convert Teradata stored procedures and BTEQ?
By rewriting, not transpiling. Cursors become set-based MERGE or window functions; BT/ET transactions drop because Delta is ACID per statement; EXECUTE IMMEDIATE dynamic SQL becomes Python spark.sql(); macros become views or functions; and BTEQ scripts become notebooks or Workflows, with .EXPORT turning into COPY INTO or a DataFrame write.
How do you validate a Teradata to Databricks migration?
Reconcile source and target: row counts, column-level aggregates, and hash matching per table. Lakebridge ships a reconcile command for this, but the durable answer is a repeatable validation harness plus CI/CD, because a migration is not done when the SQL runs — it is done when the numbers match and stay matched.
Planning a Teradata → Databricks move?
We scope the real work — the complexity assessment, the automatic-vs-manual split, the stored-procedure and BTEQ rewrites, and the reconciliation harness that proves the numbers match. Bring your Teradata codebase; leave with a migration plan and an estimate the same business day.
Book a 30-minute intro call Prefer email? clayton@quantsolvent.co