Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

stevin

Safe plan/apply migrations for Unity Catalog tables and schemas. Describe the tables you want in YAML or SQL, see what it takes to get a live catalog there — which changes are free, which rewrite 400 GB, which destroy something — and then apply it.

ci Docs Python License: Apache-2.0 Ruff

Every workspace has tables that nobody's pipeline owns: the table a notebook appends to, the lookup table, the table another system writes into. Someone made each once, with a CREATE TABLE in a notebook, and changing one is another notebook, run by hand, once per environment. stevin keeps those tables, and the access around them, as specs in git: a change is a plan in a pull request, and a change made by hand shows up as drift.

Status: alpha. Every milestone in the design is built — plan, apply (rewrites included), drift, the GitHub Action, and governance (tags, grants, masks, row filters, views). New in 0.4.0: tables another tool owns are reported as theirs (owned_elsewhere, dbt's manifest, dlt's schemas), a governance-only spec says who may see such a table, a table's shape can come from an ODCS data contract (from_contract), the ABAC policies a table is under are read into its plan, and stevin access <table> says who may see one table and through what. 0.4.0 also removed SQL hooks and standalone SQL functions, and it does not apply a plan file saved by 0.3 — the changelog says why and what to do. Every release so far is an alpha, and the spec format may still change before the first stable one. It is tested offline against a fake warehouse, and a live suite runs what it assumes about Databricks against a real workspace. That suite has settled most of those assumptions and not all of them. How it is tested says what each layer proves and lists what is still open, and stevin verify runs the same assumptions in a workspace of your own. Try it on a dev catalog before production.

Named after

Simon Stevin (1548–1620), engineer and mathematician: he designed sluices and introduced decimal notation. Precision before action — which is what a plan is.

Up to 0.2.0a4 stevin was called deltaplan. That command and a deltaplan.yml still work — coming from deltaplan says what changed and what didn't.

Install

uvx --prerelease allow stevin --version      # run it once, nothing installed
uv tool install --prerelease allow stevin    # or keep it

Every release so far is a pre-release, which installers skip unless asked — hence the flag. pip install --pre stevin works too.

Quickstart

mkdir crm-tables && cd crm-tables
stevin import main.crm    # a spec per table, and a stevin.yml with one target
stevin plan               # what it would do; nothing is touched
stevin apply              # the same plan — shown, asked about, then run

Then change a table by editing its spec, and stevin apply again. Get started → is those ten minutes on your own workspace, every step shown; the tour → takes one project from nothing to a reviewed pull request. The docs have the spec format, the commands and the safety model, and docs/DESIGN.md is the source of truth.

What it is for

  • The tables and access your transformation tool doesn't own. dbt, Lakeflow or SQLMesh own what they build. stevin owns what they read and what they leave to a setup job: the tables notebooks and external systems write into, lookup tables, filtered views, and who may see what — grants, column masks, row filters. It never touches what another tool built — where the line is, per tool and three access recipes — and it runs from CI at deploy time, or from a job where CI can't reach the workspace.
  • Tables your notebooks write. A spec declares the table and stevin creates it. The notebook writes to it, and may add a column. drift shows the change the next morning, and adopt puts it into the spec as a diff to review: the loop, step by step.
  • What another tool owns stays theirs. stevin.yml says which tables another tool owns (owned_elsewhere:), a dbt manifest.json says it for dbt, and a schema that holds dlt's _dlt_loads and _dlt_version tables is dlt's. A plan reports those tables as theirs — "dbt's", "dlt's", "the data-science team's" — and not as unmanaged. A spec for a table dbt builds is refused.
  • Access for a table stevin doesn't make. A governance-only spec has no column types: it puts tags, grants, a row filter, an owner and column masks on a table dlt or a notebook team makes, and says nothing about its shape. The table is never claimed, reshaped or dropped.
  • A table's shape from a data contract. from_contract: points a spec at an ODCS contract. The columns, types, keys and descriptions come from the contract, and the spec adds what a contract doesn't say: clustering, properties, grants, a row filter, masks — how a contract is read.
  • Unity Catalog is the state. There is no state file to store, lock or repair. stevin reads the live catalog — information_schema and the tables' own definitions — every time it plans, and the one thing it has to remember, that it made a table, is a property on that table.
  • Plans that know there is data in the table. A change is an ALTER TABLE wherever Delta allows one, never a drop and a recreate. The plan says which changes are metadata-only, which need a table feature switched on first (a rename needs column mapping), and which rebuild the table — with its size, and with the data, the identity and the history kept.
  • Destructive changes are flagged, never implied. Dropping a column or a table is a step marked destructive, and apply refuses it without --allow-destructive. Only tables stevin made can ever be dropped; everything else in the schema is reported as unmanaged and left alone. A plan that has gone stale is refused.
  • Next to an Asset Bundle, if you have one. Your databricks.yml already has the targets, the workspaces, the variables and often the schema. stevin asks the Databricks CLI what they resolve to, names things the way a deploy would, and leaves what the bundle declares to the bundle — details. Without a bundle, a stevin.yml says the same things.

Also: nested types are first class — struct, array and map fields diff by path (address.element.zip), renames and comments included — and the plan is a data structure, so the terminal, the pull-request comment and the JSON file all show the same one.

The spec

table: ${catalog}.sales.orders
comment: Order facts
cluster_by: [order_date]
columns:
  - name: order_id
    type: bigint
    nullable: false
  - name: customer_ref
    type: string
    renamed_from: cust_id
  - name: address
    type:
      struct:
        - {name: street, type: string}
        - {name: zip, type: string}

Or as SQL — the same model, read with sqlglot:

CREATE TABLE ${catalog}.sales.customers (
  customer_id BIGINT NOT NULL,
  name        STRING,
  CONSTRAINT customers_pk PRIMARY KEY (customer_id)
)
CLUSTER BY AUTO;

A project can mix both. SQL specs support what sqlglot can parse; YAML supports everything — the list says which.

The plan

A stevin plan: a rename, a widening, a backfilled NOT NULL column, a nested field, a CHECK and a grant, each with its numbered, risk-labelled steps

Why not Terraform?

Terraform is the right tool for the platform — workspaces, catalogs, warehouses, permissions — and stevin doesn't try to be it. Tables are a different kind of thing, because a table holds data.

  • Replace means drop. When Terraform can't change something in place it replaces the resource: destroy, then create. For a cluster that costs a restart; for a managed table it costs the rows. stevin has no replace. A change is an ALTER, or a rebuild that keeps the data, or — when it really is a drop — a step that says destructive and won't run until you allow it.
  • The catalog is the only copy of the truth. Terraform keeps a state file, and a table that already exists has to be imported into it before Terraform will manage it. stevin has none: it reads Unity Catalog every time, a table somebody altered by hand shows up as drift, and adopting an existing table is writing a spec for it — stevin import does.
  • Delta has rules a general tool doesn't model. Renaming a column needs column mapping; int to bigint needs type widening; a struct becoming an array needs the table rebuilt. stevin plans each as the separate, numbered step it is, and tells you how much a rebuild rebuilds before it starts.

What it will not do

The scope is closed. stevin does not:

  • manage ABAC policies. Those are written in Terraform or SQL;
  • create catalogs, external tables, governed-tag definitions, groups or service principals. Those are the platform's, and Terraform's;
  • decide who may have what. It has no rules, no approvals and no policy engine: it puts in place what a spec says;
  • check data quality or service levels;
  • manage materialized views and streaming tables. Those are their pipeline's;
  • shape a table another tool builds, or detect a Lakeflow pipeline's tables by itself;
  • run from a notebook. It applies from CI, or as a job task where CI can't reach the workspace;
  • run SQL of your own around a change, or keep SQL functions that no mask or row filter names. Both left in 0.4.0.

A request for one of these is a snippet in your own repository, not a feature. Next to other tools draws the line per tool.

When you no longer need it

When an Asset Bundle has a table resource that plans changes to a live table — which are free, which rewrite it, which destroy something — use that. Today a bundle declares schemas and volumes, and no tables.

Commands

stevin validate -t dev             # spec lint, no connection needed
stevin import main.sales -o tables # live tables -> YAML specs
stevin apply -t dev                # plan, show, ask, run
stevin plan -t dev [-o plan.json] [--select sales.orders] [--format rich|md|json]
stevin show plan.json -f md        # render a saved plan, no warehouse needed
stevin apply plan.json [--allow-destructive]   # run a reviewed plan, as CI does
stevin drift -t dev                # exit code 2 on drift, for CI
stevin access main.sales.orders    # who may see a table, and through what
stevin force-unlock -t dev

In CI

- uses: kostavo-oss/tools/packages/stevin@stevin-v0
  with:
    target: prod        # comments the plan on the pull request

Plan on pull requests, apply on merge, catch drift nightly — see the CI guide.

Where it fits

stevin is one of the Kostavo tools: small tools for the ugly gaps on Databricks, one gap each. Its gap is the table nobody's pipeline owns: the table a notebook appends to, the lookup table, the table another system writes into, and who may see them. Each works alone. Kostavo is the company behind them: it builds a governance platform for Databricks workspaces, and the tools are complete without it.

Community project, not affiliated with or endorsed by Databricks.

Development

stevin uses mise + the Astral stack (uv, ruff, ty).

mise install     # pinned Python + uv
uv sync          # .venv with deps and dev tools

mise run check   # lint + format check + types + unit tests
mise run test    # uv run pytest tests/unit
mise run docs    # preview the docs at localhost:8000

See CONTRIBUTING.md for the architecture and the house rules.

License

Apache-2.0 — see LICENSE.

Metadata

Release files for stevin 0.4.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stevin 0.4.0a1
File Size Uploaded Provenance Actions
stevin-0.4.0a1.tar.gz 507.6 kB Without provenance Details for stevin-0.4.0a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stevin 0.4.0a1
File Interpreter ABI Platform Actions
stevin-0.4.0a1-py3-none-any.whl Python 3 none any Details for stevin-0.4.0a1-py3-none-any.whl

Total release size: 782.1 kB

Release files / stevin-0.4.0a1.tar.gz

Download URL stevin-0.4.0a1.tar.gz
Size 507.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b1cd37f3ff948010d12ed9956e3b0137fc91093972ff581c72576cfe806c5b6f
BLAKE2b-256 checksum
How to use checksums
952cd047e0353b165c28fd5c24a3a333c611de57637adefdf753959c7ec3ea05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / stevin-0.4.0a1-py3-none-any.whl

Download URL stevin-0.4.0a1-py3-none-any.whl
Size 274.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00c1052e40fdfc4534d4c97e165bcee2f1e6429c2f85851710c9af1875cbf603
BLAKE2b-256 checksum
How to use checksums
68538f1d5c09f63df0345b5251fe7573dc5c1e6f73fca95f7f1049f910c1340f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for stevin 0.4.0a1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page