Skip to content

Tomoscorbin/delta-engine

Repository files navigation

delta-engine

Live Databricks Tests

Declarative, safety-first schema and metadata management for Delta Lake tables on Databricks.

Define the state your tables should have in Python. Delta Engine reads their current Unity Catalog state, calculates the difference, validates whether each change is safe, and executes only the DDL needed to reconcile them.

There are no migration scripts to maintain and no DDL statements to hand-order. Your declarations remain the source of truth across the lifetime of the table.

What Delta Engine gives you

  • Desired-state reconciliation: declare the complete table state rather than a sequence of migrations.
  • Safe in-place evolution: unsafe changes, such as type narrowing, repartitioning or destructive schema changes, are rejected before any SQL runs.
  • Reviewable plans: preview semantic changes and compiled DDL with a dry run before applying them.
  • Drift detection: compare version-controlled declarations against the live Unity Catalog state in local workflows or CI.
  • Scoped ownership: manage governance metadata without taking ownership of a table’s schema or data lifecycle.
  • Dependency-aware execution: synchronise groups of tables in the correct order when primary-key and foreign-key relationships exist.

Delta Engine does not need to own how a table’s data is produced. It can manage the catalog state around tables populated by PySpark jobs, declarative pipelines, dbt models or other systems.

Install

pip install delta-engine

The base package is pure Python with no runtime dependencies: declaring and planning schemas needs no PySpark. Running a sync needs either a Spark session supplied by Databricks Runtime or a Databricks SQL warehouse connection. Pin the Delta Engine release and lock the complete environment for repeatable production deployments. On Databricks compute, install only the base package and use the runtime's Spark and Delta libraries. Outside Databricks compute, install the [sql] extra to sync through a SQL warehouse — for example, schema sync from CI without a Spark session or cluster. See the installation guide for the supported installation paths and their requirements.

Install delta-engine[cli] to run delta-engine plan MODULE:ATTRIBUTE through any standard Databricks unified-auth configuration. The CLI always shows the semantic diff, report, and planned SQL and never applies the generated plan. See the CLI reference.

Quickstart

from delta_engine.databricks import build_spark_engine
from delta_engine.schema import Column, DeltaTable, Integer, String

customers = DeltaTable(
    catalog="dev",
    schema="silver",
    name="customers",
    columns=[
        Column("id", Integer(), nullable=False),
        Column("name", String()),
    ],
)

engine = build_spark_engine(spark)  # `spark` is provided by your Databricks notebook
engine.sync(customers)         # creates the table, or no-ops if it already matches

Every sync follows the same process:

read live state
    → compare with the declaration
    → validate the differences
    → build a deterministic plan
    → resolve table dependencies
    → execute

Validation happens before execution. When a table contains an unsafe change, Delta Engine does not execute a partially valid plan for that table.

Documentation

Start with how a sync works for the model, or jump to what you need:

Getting started

Concepts

How-to guides

Reference

Architecture

About

Declarative schema management for Delta Lake on Databricks: define the table state you want, then safely plan, validate, and apply catalog changes.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages