Clavesa for Databricks teams

Run a Databricks step outside Databricks. Keep the table, the lineage and the jobs.

Clavesa runs one step of an existing Databricks pipeline on AWS compute in your own account (Fargate or Lambda), writes the step’s table into your Unity Catalog under the same name, pushes lineage to Catalog Explorer, and starts the Databricks jobs that come next. Readers of the table change nothing.

01 Unchanged

What stays in Databricks

  • The table name, its grants and its readers.
  • Unity Catalog as the catalog.
  • Lineage in Catalog Explorer, where the clavesa step is its own box between the input and the table.
  • The downstream jobs, which clavesa starts after each successful run.

02 Reversible

A switch you can undo

  1. Preflight. A read-only check of every right in Databricks and AWS. It prints the exact GRANT statements for the admin.
  2. Shadow mode. Clavesa writes a second table next to the step’s table. The Databricks step keeps running.
  3. Daily comparison. Rows and exact sums per day in both tables, PASS or FAIL, no DBUs.
  4. Switch. Pause the Databricks job and swap the table names. Clavesa refuses to write while that job is unpaused.
  5. Roll-back. Swap the names back and unpause the job. The old table stays for a month.
clavesa preflight: every row ok, Ready: nothing is missing
The preflight on the test workspace (the email address is redacted).
The daily comparison: every day matches, PASS
The daily comparison: shadow table against the Databricks step's table.

03 Product

In the clavesa UI

The clavesa Unity Catalog page: each pipeline's tables with a Catalog Explorer link
Each pipeline's tables, with links into Catalog Explorer.
A run's Databricks card: the job it started and a link to that run
A run page: the Databricks job the run started, linked to its run.

04 Bundles

A whole job from its bundle

A job in a Databricks Asset Bundle (databricks.yml) deploys to clavesa from a target of the same bundle. clavesa bundle plan says task by task where it runs and what to change. deploy, run, compare, switch and destroy work as for one step. A task that clavesa does not run stays on Databricks, and clavesa starts it in its place in the job.

  • Tested end to end with Databricks’ own default-sql example: one bundle, deployed as a Databricks job and as a clavesa job. The comparison passed for both tables (orders_raw 107 days, orders_daily 31 days). One clavesa run cost about 0.01 USD of AWS.
  • Shadow tables. With Unity Catalog, each table the job writes is written as <table>_clavesa, an external Delta table, next to the Databricks table. The Databricks job keeps its own tables until the switch.
The clavesa Bundles page: the plan of the aws target, Ready, both SQL tasks on clavesa, and the generated pipeline
The Bundles page: the plan of the default-sql example's aws target, and the pipeline it generated.

Lineage: what you see and what it needs

  1. It uses Databricks external lineage, which Databricks lists as Public Preview.
  2. In the Lineage graph, each clavesa task is an external object of type ‘clavesa transform’ between the tables, with the column mapping. It is not shown as a Databricks job. The standard table lineage API returns nothing for these tables; only the external lineage API returns them.
  3. Clavesa’s service principal needs CREATE EXTERNAL METADATA on the metastore and MODIFY on each table it writes.
Catalog Explorer lineage graph: orders_raw_clavesa, then the clavesa task as an external metadata object of type clavesa transform, then orders_daily_clavesa
Catalog Explorer: the clavesa task is an external object of type 'clavesa transform' between the two shadow tables.

Table maintenance

  • clavesa pipeline optimize --vacuum compacts and vacuums the tables of a job from a bundle. A sql_task with OPTIMIZE … ZORDER BY and VACUUM also runs on clavesa. Both were tested live.
  • Databricks predictive optimization does not cover the _clavesa tables, because it runs only on managed tables.
  • Scheduled OPTIMIZE and VACUUM are not built yet (GH #26).

The user guide is docs/databricks/bundles.md; the end-to-end test is bundle-both-ways.

05 Cost

The numbers, honestly

  • Measured on synthetic events (about 1 KB each), ARM Fargate in us-east-2: a 1 GB day took 34 seconds of task time at 8 vCPU and 16 GB, plus one to two minutes for AWS to start the task. Time grew linearly with the data up to 1.25 GB, the largest run measured.
  • Estimated, not measured: a step that reads 2 TB a month (67 GB a day) comes to about 11 minutes a day at 8 vCPU, about 2 USD a month of Fargate, about 3 to 4 USD a month with the fixed AWS costs. 67 GB is 54 times the largest measured run, so the line may bend.
  • The same step on Databricks jobs compute: about 9 to 21 USD a month at list prices, also a paper estimate. Read your step’s real cost in system.billing.usage before you decide.
  • The preflight and the daily comparison cost no DBUs.

06 Limits

What is not proven yet

  • Tables with Delta features clavesa cannot write (deletion vectors, liquid clustering) are checked by the preflight but were not tried live.
  • The work size is extrapolated.
  • Table registration and lineage use Databricks Public Preview APIs.

The design is in ADR-027. What a small step costs on Lambda, measured: PySpark and Delta Lake on AWS Lambda.